'Mongoose $nin with array of ObjectId
I am facing a problem with mongoose. I can't do a query filter with $nin or $ne on an array of ObjectId.
Like:
query: {
objectIds: { $nin: [ objectId1, objectId2 ] }
}
I tried to send an ObjectId.toString(), an ObjectId, but nothing works. However, if I replace the ObjectId array by a string array or put ObjectId in it, it works.
Any idea why it doesn't work with ObjectId?
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
