I am trying to learn how to query Mongo in more advanced ways. Say my data structure is this:
{ "_id" : "-bcktick-ajman-ae-292932", "asciiname" : "`Ajman", "alternatenames" : [ { "isolanguage" : "no", "alternateNameId" : 2698358, "alternateName" : "Ajman" }, { "isolanguage" : "en", "alternateNameId" : 2698357, "alternateName" : "Ajman" } ] }
So, finding Ajman easy:
db.cities.find({ "asciiname":"`Ajman" })
However, I want to find cities that only have isolanguage ru . You will notice that isolanguage is in an array of alternate names .
But I can not find the correct syntax in either the client or mongoid
It would be very helpful to rate one (or both).
thanks
source share