MongoCursorException (13038)
localhost:27017: can't find any special indices: 2d (needs index), 2dsphere (needs index), for: { $and: [ { poi: { $near: [ 114.033208, 22.549245 ] } }, { isbanned: 0 }, { user_id: { $ne: "57a0b941461584002a8b4568" } }, { _id: { $nin: [ "00000000" ] } } ] }
查询位置信息的时候报错
我看了大部分解释都是索引问题
db.accounts.ensureIndex({poi:”2d”})
试了N次,无果,是在是没折了,我怀疑是版本问题,问题版本是2.4.x,我把mongodb版本升级到了2.6.x,结果就没问题了~
> db.accounts.ensureIndex({poi:"2d"})
{
"createdCollectionAutomatically" : false,
"numIndexesBefore" : 1,
"numIndexesAfter" : 2,
"ok" : 1
}
呜呜呜,折腾了一天,2d查询ok
本文记录了解决MongoDB中2D查询报错MongoCursorException(13038)的过程,通过升级MongoDB版本从2.4.x到2.6.x解决了无法创建2D索引的问题。
3931

被折叠的 条评论
为什么被折叠?



