タグ

関連タグで絞り込む (2)

タグの絞り込みを解除

Rubyとmongoidに関するmitukiiiのブックマーク (1)

  • Rails3 対応 MongoDB ORM、Mongoid 詳解―インデックス - babie, you're my home

    index マクロを使うことにより、ドキュメントにインデックスを定義することができます。:unique オプションをつけると、ユニークなインデックスを構築できます。オプションは必須ではありません。 class Person include Mongoid::Document field :ssn index :ssn, :unique => true end 以下のようにして、エンベッドされたドキュメントにもインデックスを定義することができます。 class Person include Mongoid::Document embeds_many :addresses index "addresses.street" end 複数フィールドに対してもインデックスを定義することができます。また、ソート順も定義できます。 include Mongoid::Document field :fir

    Rails3 対応 MongoDB ORM、Mongoid 詳解―インデックス - babie, you're my home
  • 1