Mongo db update a object in a array, just first object is updated

I am using the node.js framework from this tutorial:

I have a strange problem which i dont understand, i have make a picture for better understanding:

picture from my database and nodejs code

If i just try to update another object in this array it does not work, but if i update the first object it does work, so please does somebody know why, is the mongo client which i use not good or does my query have a error?


First off, code examples shouldn’t be shared via an external picture. This should be provided as a code snippet in your question.

Now as to the reason why it isn’t working. You don’t have an array of objects, you have an array of array of objects.

If you look at the first one in the array of questions, it is an object, but if you look at the second one, you can see that it is an array that includes 1 object in it. You will need to make sure your questions array is an array of objects and not an array of arrays with objects. Then your query will work. See below from your given example.

Highlighted example