0

My collection

{"_id" : ObjectId("58240d6eb3fe299a1f28bdf0"),
    "id" : NumberLong(52),
    "user_id" : NumberLong(2),
    "user_type" : "user",
    "type_id" : "399278",
    "type" : "poi",
    "type_name" : "Kala Ghoda Amphitheatre",
    "attending" : NumberLong(0),
    "domain" : "",
    "track_time" : "0000-00-00 00:00:00",
    "latitude" : "18.92728500",
    "longitude" : "72.83274200",
    "fb_postid" : "",
    "event_date" : "0000-00-00",
    "m_event_date" : NumberLong("-62169984000"),
    "m_type_id" : "poi__399278",
    "loc" : {
        "type" : "Point",
        "coordinates" : [
            18.927285,
            72.832742
        ]
    }

Create index db.user_tracking.ensureIndex({ "loc": "2dsphere" })

I have this error:

"ok" : 0,
"errmsg" : "Can't extract geo keys: { _id: ObjectId('58240d6eb3fe299a1f28bdf1'), id: 84, user_id: 2, user_type: \"wcities\", type_id: \"23621\", type: \"poi\", type_name: \"Alcatraz Island\", attending: 1, domain: \"Parrot\", track_time: \"2015-02-02 06:33:34\", latitude: \"37.82668800\", longitude: \"-122.42302500\", fb_postid: \"\", event_date: \"0000-00-00\", m_event_date: -62169984000, m_type_id: \"poi__23621\", loc: { type: \"Point\", coordinates: [ 37.826688, -122.423025 ] } }  longitude/latitude is out of bounds, lng: 37.8267 lat: -122.423",
"code" : 16755
}
Rahul Gupta
  • 972
  • 11
  • 29
dev
  • 1
  • 7
  • First Think when you create collection remember coordinates[,] ok.Not coordinates[,] – dev Nov 10 '16 at 08:05

1 Answers1

0

The error says it all longitude/latitude is out of bounds

just see this answer for the range allowed. your latitude of lng: 37.8267 lat: -122.423 goes beyond the range of +90/-90 . You need to correct that document which have this data.

More on geoJSON

Community
  • 1
  • 1
Rahul Kumar
  • 2,781
  • 1
  • 21
  • 29