'Unrecognized pipeline stage name: ‘$unionWith’”
I’m using "mongodb": "^4.4.1" version for NodeJS. I'm trying to make the following query:
db.collection('myCollection').aggregate([
{
$unionWith: {
coll: "anotherCollection"
}
}
])
But i have the following error : “Unrecognized pipeline stage name: ‘$unionWith’”
Can you explain to me why am I getting this error?
I tried to explore the mongo signatures in node_modules/mongodb/src/cursor/aggregation_cursor.ts but there is no unionWith signatures.
Solution 1:[1]
Okay, i found the solution, it's my fault i made a mistake. It was working perfectly at node.js runtime, but the error was thrown during the jest unit tests. Because i forgot to update the mongodb memory server version for jest usage.
module.exports = {
mongodbMemoryServerOptions: {
binary: {
version: '5.0.6',
skipMD5: true,
},
autoStart: false,
instance: {},
},
};
It's working perfectly now.
Thank for your time and have a good day.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | mickatdj |
