Y
Y
Yarchick2018-11-22 12:13:54
MongoDB
Yarchick, 2018-11-22 12:13:54

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

1 answer(s)
A
Andrey Mensky, 2018-11-22
@YarchicK

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 question

Ask a Question

731 491 924 answers to any question