question about mongoose geospatial query and aggregation

27 views
Skip to first unread message

Satyen Dhingra

unread,
Dec 5, 2022, 3:43:46 PM12/5/22
to Mongoose Node.JS ODM
I am trying to run a query and want to aggregate results based on location, 

here is the query + aggregation

let qry = Users.find(); 
qry.where('userType').equals('provider'); 
qry.where('firstName').equals(firstName); 

  let ret = await Users.aggregate().near( 
                 {    near: [lng, lat], 
                      maxDistance: radiusInMiles * MILES_TO_METERS, 
                      distanceField: 'distance', 
                      query: qry 
                     } ).exec();

when I try to run this, I get a "cyclic dependency detected" error, any ideas...

Reply all
Reply to author
Forward
0 new messages