How to build Mongoose query for distance and something else

79 Views Asked by At

I have a schema like this.

const Company = new mongoose.Schema({
    profile: {
        name: String,
        email: String,
        password: String,
        description: String,
        phone: String,
        location: {
            address: String,
            latitude: Number,
            longitude: Number
        }
    },
    posts: Array,
    permission: { type: Number, default: 1 },
});

I have to search by distance, name, etc...

The problems is to search by distance.

How to make query for search by distance plus name, etc?

Thanks

0

There are 0 best solutions below