Hello everyone,
thank you for having me and potentially helping out already. I am currently stuck on an in my eyes simple? update query.
The scenario:
We save texts where users can save their own written solution. For the texts, we have our own collection the same as for the users. When the user submits a solution it is saved in the user Document in an array as an object containing the text ID and the solution itself. This works fine for the first time by using $push. When writing more text or editing this solution a new array object is created, instead of updating the one present:
Example:
{
userID: 1,
solutions: [
{ textID: 2,
solution: "some solution text"
}
]'
}
As mentioned I used $push with using the following filter: { userID: 1, solutions.textID: 2 } and it still created a new one .
Maybe I am just too much into it and not able to look left and right here, that’s why I reached out to you. Is it a flaw with my data model or should I use aggregations?
Any help much appreciated
Stay save!