I'm trying to run this query:
db.zips.find({"state":"GA"}, {"pop":{$gt:0}}).sort({pop:1}).limit(5)
But I keep getting this error:
"errmsg" : "Unsupported projection option: pop: { $gt: 0.0 }"
When I run this query, it works perfectly:
db.zips.find({"state":"GA"}).sort({pop:1}).limit(5)
I'm trying to find the fields where "state" = "GA" and then where "pop" is greater than 0 and limit it to 5 results and sort them in ascending order.
When I put the {"pop":{$gt:0}}
part as the first argument in the find function, it runs, but it ignores the fact that I only want states that equal "GA". I'm not sure how to fix this, does anyone know what's wrong?
所有评论(0)