Warning: file_get_contents(/data/phpspider/zhask/data//catemap/6/mongodb/11.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
MongoDB地理索引在生产服务器上不工作_Mongodb_Ubuntu - Fatal编程技术网

MongoDB地理索引在生产服务器上不工作

MongoDB地理索引在生产服务器上不工作,mongodb,ubuntu,Mongodb,Ubuntu,刚转到生产Ubuntu实例,我得到: planner returned error: unable to find index for $geoNear query, name=MongoError, ok=0, errmsg=error processing query: ns=esper.usersTree: $and gender $eq "female" profileSetup $eq true age $lt 25 age $gt 21 $not _id $eq Objec

刚转到生产Ubuntu实例,我得到:

 planner returned error: unable to find index for $geoNear query, name=MongoError, ok=0, errmsg=error processing query: ns=esper.usersTree: $and
gender $eq "female"
profileSetup $eq true
age $lt 25
age $gt 21
$not
    _id $eq ObjectId('5b248a699dc80c04b112a289')
GEONEAR  field=location maxdist=10000 isNearSphere=0
但是,索引已配置为:


尝试重新启动MongoDB。是否需要运行某种缓存或命令来配置索引?

您的查询是什么?同一查询在本地工作您应该将查询发布到您的查询位于不同的命名空间(
esper.users
)上,而不是为
getIndexes()
(使用
test.users
)提供的输出。如果您更改到同一个数据库(
使用esper
),我怀疑您会发现该数据库中没有创建地理索引。--谢谢Stennie post的回答,以便我可以标记为已接受