{ [MongoError: exception: geoNear command failed: { ok: 0.0, errmsg: "no geo indices for geoNear" }]
  name: 'MongoError',
  message: 'exception: geoNear command failed: { ok: 0.0, errmsg: "no geo indices for geoNear" }',
  errmsg: 'exception: geoNear command failed: { ok: 0.0, errmsg: "no geo indices for geoNear" }',
  code: 16604,
  ok: 0 }

原因是你指定的 feild 的 index 不是坐标.

db.bingos.createIndex({loc: "2dsphere"})

kelvinlee
867 声望9 粉丝

希望可以成为全栈.