planner返回错误:找不到$geoNear查询Python的索引

planner返回错误:找不到$geoNear查询Python的索引,python,mongodb,pymongo,geo,Python,Mongodb,Pymongo,Geo,我试图用pymongo在python中使用$near进行查询 我已经创建了一个索引 db.operadores.createIndex({location:“2dsphere”}) 如果我询问这些问题: db.operadores.find( { id: { $in:['10335282', '10335539', '10335541', '10476793', '10484737', '10526744', '10552801', '10556323', '10625

我试图用pymongo在python中使用$near进行查询

我已经创建了一个索引

db.operadores.createIndex({location:“2dsphere”})

如果我询问这些问题:

db.operadores.find(    {
     id: {
     $in:['10335282', '10335539', '10335541', '10476793', '10484737', '10526744', '10552801', '10556323', '10625572', '10759263', '10819053', '10835837', '10842699', '10876588', '10886964', '10892128', '30377476', '70000240', '70000461', '900705728']
     },
     location:
       { $near :    
          {
            $geometry: { type: "Point",  coordinates: [-74.05937569999998, 4.6813047 ] },
            $maxDistance: 5000
          }
       }    }
    ).sort({location:1})
但在python中,如果我进行查询:

data = self.__operators.find({
            'id': {
                '$in': ['10335282', '10335539', '10335541', '10476793', '10484737', '10526744', '10552801', '10556323', '10625572', '10759263', '10819053', '10835837', '10842699', '10876588', '10886964', '10892128', '30377476', '70000240', '70000461', '900705728']
            },
            'location':
                SON([("$near", [-74.05937569999998, 4.6813047 ]), ("$maxDistance", 1000)])

        })
这显示了一个执行选项:

可能重复的2dsphere索引必须使用$geometry查询。。。无法使用$near
 raise OperationFailure(msg % errmsg, code, response)
 pymongo.errors.OperationFailure: error processing query:
 ns=unilever.operadoresTree: $and
     id $in [ "10335282" "10335539" "10335541" "10476793" "10484737" "10526744" "10552801" "10556323" "10625572" "10759263" "10819053"
 "10835837" "10842699" "10876588" "10886964" "10892128" "30377476"
 "70000240" "70000461" "900705728" ]
     GEONEAR  field=location maxdist=1000 isNearSphere=0 Sort: {} Proj: {}  planner returned error: unable to find index for $geoNear query