Here is my find request:
Recipe.find({'author.id': {$not: {user}}}
Here is the documentation: https://docs.mongodb.com/manual/reference/operator/query/not/index.html
Here is the error:
Error: Can't use $not with ObjectId.
I want to find all Recipes that are not authored by the current user. The arguments are working fine, so that's not the issue. There must be a way to do this, or am I doing something wrong?
You should use $ne
Recipe.find({ "author.id": { "$ne": user }});
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With