Hi,
I recently started using node-red and I have some issues with node-red-contrib-mongodb4 and the aggregate operation. I get the following error message : "A pipeline must be an array of objects" code: 14, but when I check the input with the debug note it is clearly an array with multiple objects.
I can't seem to find a solution, as it works without issue in python. Maybe someone else knows, what I am doing wrong.
This is my code for reference:
msg.payload = [
{
"$match": {
"ENG": "ENG"
}
},
{
"$lookup": {
"from": "ENG",
"localField": "Fauf",
"foreignField": "Prod_Fauf",
"as": "joinedData"
}
},
{
"$set": {
"joinedData": { "$first": "$joinedData" }
}
},
{
"$set": {
"ENG_ID": "$joinedData.ENG_ID",
"Reporter": "$joinedData.Reporter"
}
},
{
"$unset": ["joinedData", "_id"]
}
];
return msg;