[SERVER-10095] 2dsphere index creation fails with null coordinates values Created: 03/Jul/13 Updated: 16/Sep/22 Resolved: 01/Aug/13 |
|
| Status: | Closed |
| Project: | Core Server |
| Component/s: | Index Maintenance |
| Affects Version/s: | 2.4.4 |
| Fix Version/s: | None |
| Type: | Bug | Priority: | Major - P3 |
| Reporter: | Adam Fields | Assignee: | Unassigned |
| Resolution: | Duplicate | Votes: | 1 |
| Labels: | None | ||
| Remaining Estimate: | Not Specified | ||
| Time Spent: | Not Specified | ||
| Original Estimate: | Not Specified | ||
| Issue Links: |
|
||||||||
| Operating System: | ALL | ||||||||
| Steps To Reproduce: | Try to build a 2dsphere index on a collection where some documents have a null value for the coordinates field. |
||||||||
| Participants: | |||||||||
| Description |
|
When trying to index a collection with a 2dsphere index, even with the sparse option in the nightly build (7/3), the index creation throws an error if some documents have a null value for the coordinates field (not a missing key). Specifically, this is a collection of tweets directly from the twitter API - the "coordinates" field has a geojson structure if there is geocoding data, but if there is none, the "coordinates" field still exists and has a null value. The error is: "Can't parse geometry from element: coordinates: null" |
| Comments |
| Comment by Jayesh Amin [ 25/Nov/13 ] |
|
Not sure about this being a duplicate. The fixed issue seems to be about the 2dsphere index working when the coordinates field is missing. This one, as I can confirm as well, is about the field being present but containing null as the value and 2dsphere creation failing with: Now this may be by design but I would like to know that so I can look at workarounds. note: My use case is the same as original poster: Dumping Twitter stream output to mongoDB. For geo-enabled tweets, coordinates are populated as geojson structure. But when not geo-enabled, twitter uses null value rather than not drop the field. |
| Comment by Daniel Pasette (Inactive) [ 01/Aug/13 ] |
|
This is a duplicate of |
| Comment by felipe ieder [ 30/Jul/13 ] |
|
I have the same issue. Some of the coordinate's records in my collection have 'null' and therefore 2dsphere index can't be created. Documentation says though "To create a geospatial index, your documents must have a coordinate pair. For maximum compatibility, these coordinate pairs should be in the form of a two element array, such as [ x , y ]". So I'm not entirely sure whether this is by design or a bug. Is there any workaround for when the collection has a null value in the coordinates? |