Monday 26 March 2018

I can't for the life of me work this out (mongo aggregation error)

Trying to run this using MongoDB. const users = await Users.aggregate([ { $geoNear: { near: { type: "Point", coordinates: [ -73.99279 , 40.719296 ] }, distanceField: "dist.calculated", spherical: true }, $match: { $and: [{ gender: `${match}` }, { _id: { $ne: ObjectId(`${id}`) } }] } } ]) and getting the error: "Arguments must be aggregate pipeline operators"Both the $match and $geoNear WORK separately. When I bring em together it doesn't. Any thoughts?

Submitted March 27, 2018 at 01:26AM by jamesfriedal

No comments:

Post a Comment