[SERVER-10917] Exists on geospatial fields Created: 26/Sep/13 Updated: 10/Dec/14 Resolved: 07/Oct/13 |
|
| Status: | Closed |
| Project: | Core Server |
| Component/s: | Geo |
| Affects Version/s: | 2.4.6 |
| Fix Version/s: | None |
| Type: | Bug | Priority: | Major - P3 |
| Reporter: | Yuriy Trofimenko | Assignee: | Unassigned |
| Resolution: | Duplicate | Votes: | 0 |
| Labels: | None | ||
| Remaining Estimate: | Not Specified | ||
| Time Spent: | Not Specified | ||
| Original Estimate: | Not Specified | ||
| Environment: |
Ubuntu 13.04. |
||
| Issue Links: |
|
||||||||
| Operating System: | ALL | ||||||||
| Participants: | |||||||||
| Description |
|
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}}) 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}}) So what's the proper way to get all documents that have a not null geospatial field? |
| Comments |
| Comment by Daniel Pasette (Inactive) [ 07/Oct/13 ] |
|
Thanks for the report. |
| Comment by Yuriy Trofimenko [ 26/Sep/13 ] |
|
Just a little addition: > db.places.find({"coordinates": {"$ne": null}, "deleted_at": null}) > db.places.find({"coordinates": {"$ne": null}, "deleted_at": null, code: 'DME'}) { "_id" : ObjectId("4eda607a8792904be4002b8b") ... }Well, I don't understand how it works. |