Is there an idiomatic way in Mongoid 3.0.0 to query a collection of documents using a non-unique field named id which is not the same as _id?
id
_id
#<BltBasket _id: 52a16cd36cf462b442871709, id: 9334, ...>
Thanks!
For me one good thing about mongoid is that you can define aliases.
So for your example I would see it as
field :_id, as: :uid, type: String field :id, as: :a_funky_name, type: String
which will provide you with a
BltBasket.find_by( a_funky_name: :foo )
Excuse me if I understood your question the wrong way :-)
For me one good thing about mongoid is that you can define aliases.
So for your example I would see it as
which will provide you with a
Excuse me if I understood your question the wrong way :-)