Reputation: 706
I have structure class like this:
#<Transaction _id: 54d46d6a6e6f626fbcc70000, _keywords: ["1", "test1", "test2", "abc1", "projectmongo", "last2", "taka"]>
array keyword map with: [field1, field2,...] So I want to query to get all transaction have field1 == "1" Is this possible?
Upvotes: 1
Views: 665
Reputation: 151112
MongoDB "dot notation". Don't expect there to be a "rails like" SQL ORM mapping equivalent when using functionality like arrays which are generally not supported for those storage engines:
Class.collection.find({ "_keywords.0" => "1" })
So the Moped syntax here is more raw to the MongoDB functionality.
That basically says "look at the first array element to see if it matches the value I ask for".
Upvotes: 2