It looks like at least $geoWithin and $geoIntersects will reject sibling predicates on the same field. This is inconsistent with other path-accepting predicates like $lt and $gt:
> db.foo.find({x: {$geoWithin: {"$centerSphere": [[22.0, 52.0], 0.04]}, $lt: 2}})
Error: error: {
"ok" : 0,
"errmsg" : "can't parse extra field: $lt: 2.0",
"code" : 2,
"codeName" : "BadValue"
}
> db.foo.find({x: {$gt: 0, $lt: 2}})
For $near it looks like there is some 'legacy' form of the query which we are able to parse which needs to look at neighboring elements:
> db.foo.createIndex({loc: "2d"})
{
"numIndexesBefore" : 1,
"numIndexesAfter" : 2,
"createdCollectionAutomatically" : false,
"ok" : 1
}
> db.foo.find({loc: {$near: [0, 0], $minDistance: 1}})
> db.foo.find({loc: {$near: [0, 0], $minDistance: 1, $gt: 2}})
Error: error: {
"ok" : 0,
"errmsg" : "invalid argument in geo near query: $gt",
"code" : 34413,
"codeName" : "Location34413"
}
It's unclear whether we should continue to error on unrecognized fields in that context. It's a strange grammar there.