Answer the question
In order to leave comments, you need to log in
How to update collection entries in mongodb with different results?
The question is how to update multiple documents in a collection, but with different (unique) values for each document.
So far, in nodejs, I do it through map, do the calculation and save it back to the database.
SQL has triggers that could be done, but mongo doesn't have them, what other option is there besides map?
Answer the question
In order to leave comments, you need to log in
Unfortunately map is the only option. You can try to get out with the $inc and $mul operators
https://docs.mongodb.com/manual/reference/operator...
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question