javascript - more than one 2d index, not sure which to run geoNear on - Stack Overflow

Why aggregateaggregate.near({near: coord,distanceField: "distance",maxDistance: max});can ret

Why aggregate

    aggregate.near({
      near: coord,
      distanceField: "distance",
      maxDistance: max
    });

can return

{
    "name": "MongoError",
    "errmsg": "exception: geoNear mand failed: { ok: 0.0, errmsg: \"more than one 2d index, not sure which to run geoNear on\" }",
    "code": 16604,
    "ok": 0
}

having in the scheme the only 2d index:

location: { type: [ Number ], index: '2d', sparse: true },

more or less when i remove EVERYTHING from the scheme the error doenst change why? o why...

Why aggregate

    aggregate.near({
      near: coord,
      distanceField: "distance",
      maxDistance: max
    });

can return

{
    "name": "MongoError",
    "errmsg": "exception: geoNear mand failed: { ok: 0.0, errmsg: \"more than one 2d index, not sure which to run geoNear on\" }",
    "code": 16604,
    "ok": 0
}

having in the scheme the only 2d index:

location: { type: [ Number ], index: '2d', sparse: true },

more or less when i remove EVERYTHING from the scheme the error doenst change why? o why...

Share Improve this question edited Sep 30, 2014 at 7:20 Nik Terentyev asked Sep 30, 2014 at 7:04 Nik TerentyevNik Terentyev 2,3103 gold badges19 silver badges24 bronze badges
Add a ment  | 

1 Answer 1

Reset to default 8

When you remove an index (or even an entire field) in your Mongoose model, it is not automatically removed from MongoDB.

Run db.<your collection name>.getIndexes() to view all indexes. Make a note of the name of the index you want to remove.

Run db.<your collection name>.dropIndex(<name of the index>) to remove an index.

By default, Mongoose tells MongoDB to (re-)create indexes ("ensureIndex()") when you start your app.

发布者:admin,转转请注明出处:http://www.yc00.com/questions/1745285057a4620509.html

相关推荐

发表回复

评论列表(0条)

  • 暂无评论

联系我们

400-800-8888

在线咨询: QQ交谈

邮件:admin@example.com

工作时间:周一至周五,9:30-18:30,节假日休息

关注微信