MongoError:"geoNear command failed: { ok: 0.0, errmsg: \"error processing query","code":16604,"codeName":"Location16604" MongoError:"geoNear command failed: { ok: 0.0, errmsg: \"error processing query","code":16604,"codeName":"Location16604" mongoose mongoose

MongoError:"geoNear command failed: { ok: 0.0, errmsg: \"error processing query","code":16604,"codeName":"Location16604"


I have run same code you have posted above but It didn't work for me... And I think index: 2d is not an option in mongoose model. And instead I have created index like this and worked for me.

const mongoose = require("mongoose")var Schema = mongoose.Schemavar AssoSchema = new mongoose.Schema({   userId: { type: mongoose.Schema.Types.ObjectId, ref: "User" },   picture : String,   telephone: {      type: String,      unique: false   },   loc: Array,}, { timestamps: true })AssoSchema.index({ 'loc': '2dsphere' })var Asso = mongoose.model('AssoProfile', AssoSchema)module.exports = Asso;