Thursday 20 September 2018

Mongoose/MongoDB query not working when adding two $nin values

this works fine Post.find({ username: { $nin: user.blocked } }) .sort({ created: -1 }) .then(posts => { res.json({message: posts}); }) this doesn't work even though it's how the mongodb docs describe combining $nin values Post.find({ username: { $nin: [ user.blocked, user.following ] } }) .sort({ created: -1 }) .then(posts => { res.json({message: posts}); })

Submitted September 21, 2018 at 12:55AM by temporarilyembarasse

No comments:

Post a Comment