本文介绍了mongodb:执行geoNear聚合时无法获取查询执行程序的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
您在集合Activities中缺少"2dsphere"索引.
集合Activities 中有多个地理位置索引
You are missing a "2dsphere" index in collection Activities.
There are multiple geo indexes in collection Activities
执行以下汇总时
db.Activities.aggregate([ { $geoNear: { near: { coordinates: [ -73.99279 , 40.719296 ] }, distanceField: "location.calculated", spherical: true, } } ])我遇到以下错误
uncaught exception: aggregate failed: { "errmsg" : "exception: geoNear command failed: { ok: 0.0, errmsg: \"can't get query executor\" }", "code" : 16604, "ok" : 0 }当我运行geoNear命令时,它运行正常.
when i run the geoNear command, it works fine.
db.runCommand( { geoNear: "Activities" , near: [ -73.99279 , 40.719296 ], spherical: true, })任何想法我在做什么?
Any ideas what i am doing worng ?
推荐答案问题可能是:
在Mongo shell中运行此代码以查看所有索引
Run this code in Mongo shell to see all the indexes
db.Activities.getIndexes()更多推荐
mongodb:执行geoNear聚合时无法获取查询执行程序
发布评论