1

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?

1
  • 1
    I see mongojs in 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. Commented Nov 1, 2018 at 21:29

1 Answer 1

1

looks like npm mongodb version is 2.* as it is using driver 3.4.2 version. Please upgrade mongodb package above or 3.0.2 version for working with 3.6 mongodb features.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.