MongoDB 'unable to find index for $geoNear query'

前端 未结 4 507
日久生厌
日久生厌 2020-11-29 04:37

I\'m just trying to get a simple near query working. Here\'s a sample of my document.

{\"point\": 
  {\"type\": \"Point\", 
     \"coordinates\"         


        
4条回答
  •  半阙折子戏
    2020-11-29 05:13

    db.prod.createIndex({ "location": "2d" })
    

    This solved for the same issue for me.

    Where prod is my collection name and location is name of column which stores geo location (GeoPoint)

    Some discussion about the same can be found here

提交回复
热议问题