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