Aggregate queries on MongoDB array elements -
how query mongodb array greater than($gt), less than($lt) queries?
{{ "rank": 600, "installs": [100-500], "reviewers" : [ 122, 233 ], "category" : [ "sports" ], "url" : "https://play.google.com/store/apps/details?id=com.transylgamia.kingofspeed3dautoracing" } { "rank": 900, "installs": [100-500], "reviewers" : [ 50, 100, 200 ], "category" : [ "sports" ], "url" : "https://play.google.com/store/apps/details?id=com.b2w.cricket_2014" }}
i want this:
db.col.find({rank: {$gt:500}, **reviewers.0**: {$gt:50}}, {_id:0, reviewers:1, category:1, url:1})
and first document because first element of array 1st document qualifies. tried different searches not able find help.
edit: changed integer.
Comments
Post a Comment