Am using it with nodejs in my backend. Got the following query:
db.conversations.update(
{ convoId: convoId },
{ $set: { "ids.$[elem].read" : true } },
{ arrayFilters: [ { "elem.id": userId } ] }, (err, data) => {
if(err) {
res.send(err);
}
console.log(data);
res.json(data);
});
Now in the frontend i get the error back, when the query is finished:
"No array filter found for identifier 'elem' in path 'ids.$[elem].read'"
I read, that array filters don't work if the mongodb version is below 3.6, so i updated that but it still gives me the same error.
Anyone got an idea what i'm doing wrong?
mongojsin the tags of your question. Chances are this is not actually using an updated core driver. I suggest looking at the compatibility matrix and in fact really using the core driver instead. See also the notes at the end of How to update multiple array elements with MongoDB as if you "upgraded" then you possibly have a "feature compatibility" setting problem.