[DOCS-4247] Not allowed to insert non-geo data into a geo-indexed field Created: 27/Oct/14  Updated: 16/Mar/15  Resolved: 05/Nov/14

Status: Closed
Project: Documentation
Component/s: manual
Affects Version/s: None
Fix Version/s: v1.3.13

Type: Bug Priority: Major - P3
Reporter: Andrew Emil (Inactive) Assignee: Sam Kleinman (Inactive)
Resolution: Done Votes: 0
Labels: 28qa
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Related
Participants:
Days since reply: 9 years, 15 weeks ago

 Description   

Currently we do not allow users to insert non-geo data (for example, a string) into a field that has a geo index on it. Here is an example:

> db.test.ensureIndex({a: '2dsphere'})
{
        "createdCollectionAutomatically" : false,
        "numIndexesBefore" : 1,
        "numIndexesAfter" : 2,
        "ok" : 1
}
> db.test.remove({})
WriteResult({ "nRemoved" : 0 })
> db.test.insert({_id: 0, a: "this is not a test"})
WriteResult({
        "nInserted" : 0,
        "writeError" : {
                "code" : 16755,
                "errmsg" : "insertDocument :: caused by :: 16755 Can't extract geo keys: { _id: 0.0, a: \"this is not a test\" }  geo element must be an array or object: a: \"this is not a test\""
        }
})

I could not find this limitation documented anywhere. We should make this clear to the users as it is a fairly major limitations of geo indexes.



 Comments   
Comment by Githook User [ 05/Nov/14 ]

Author:

{u'username': u'tychoish', u'name': u'Sam Kleinman', u'email': u'samk@10gen.com'}

Message: DOCS-4247: adding limit about nongeo data in a geo indexed field
Branch: master
https://github.com/mongodb/docs/commit/f95a28ce2312f8635421e5afbaf60c4cb4fbda9c

Comment by Sam Kleinman (Inactive) [ 05/Nov/14 ]

This is true of 2.6 as well for 2dsphere indexes.

Generated at Thu Feb 08 07:47:32 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.