I have a mongoosejs Query, which I am trying to execute.
I have:
query.where('loc').nearSphere(loc).maxDistance(range/6378.137);
query.where('name', name );
I want to combine the two queries without using this.find( $or: {} ).
The code is supposed to either find a document where the location is within a range, or the name matches the name provided.
Is it possible to create the query using query.or()?
I figured out the answer:
The part I couldn’t understand was how to embed a query inside the
$orclause.I thought of deleting the question, but I left it here with this solution in case it’s ever helpful to someone