-
Type: Bug
-
Resolution: Duplicate
-
Priority: Major - P3
-
None
-
Affects Version/s: 2.4.6
-
Component/s: Geo
-
None
-
Environment:Ubuntu 13.04.
-
ALL
Let's have a 'places' collection with a geospatial indexed field named 'coordinates'. I need to get all the documents that have some coordinates filled in. So I try to do this:
> db.places.find({"coordinates": {"$ne": null}})
error: {
"$err" : "geo field only has 1 element :: caused by :: $ne: null",
"code" : 13068
}
Ok, let's check for 'exists' (though that's not what I really need).
> db.places.find({"coordinates": {"$exists": true}})
{ "_id" : ObjectId("4eda5f338792904be4000397"), ... }But if we add something to the query:
db.places.find({"deleted_at": null, "coordinates": {"$exists": true}})
error: {
"$err" : "geo field only has 1 element :: caused by :: $exists: true",
"code" : 13068
}
So what's the proper way to get all documents that have a not null geospatial field?
- duplicates
-
SERVER-9389 Querying 2d indexes with $exists:false fails and the error message is incorrect
- Closed