[DOCS-1151] Error in online docu of 2d Geospatial Indexes Created: 22/Feb/13  Updated: 30/Oct/23  Resolved: 22/Feb/13

Status: Closed
Project: Documentation
Component/s: manual
Affects Version/s: None
Fix Version/s: Server_Docs_20231030

Type: Bug Priority: Major - P3
Reporter: Stefan Kreutter Assignee: Sam Kleinman (Inactive)
Resolution: Done Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified
Environment:

MongoDB 2.2


Participants:
Days since reply: 10 years, 51 weeks, 5 days ago

 Description   

On page http://docs.mongodb.org/manual/core/geospatial-indexes/#distance-calculation one can read:

db.places.find( { loc: { $centerSphere: [ [ -74, 40.74 ] ,
                                          100 / 3963.192 ] } } )

Running this command in the mongo shell produces the following error:

error: { "$err" : "geo field only has 1 element", "code" : 13068 }

The correct query has to be:

db.places.find( { loc: {$within: { $centerSphere: [ [ -74, 40.74 ] ,
                                                    100 / 3963.192 ] } } })

There needs to be a {$within: ...} wrapped around {$centerSphere: ...}.



 Comments   
Comment by auto [ 22/Feb/13 ]

Author:

{u'date': u'2013-02-22T17:18:16Z', u'name': u'Sam Kleinman', u'email': u'samk@10gen.com'}

Message: DOCS-1151: correction to $within and operation
Branch: master
https://github.com/mongodb/docs/commit/74d852507e84fcbb7938767c0f22244f37322db7

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