vendredi 19 septembre 2014

Mongodb: updating multiple docs w/different values


Vote count:

0




My Node/Mongo db has a doc with the following data in a collection called 'prices':


[ { _id: 1, price : 10 }, {_id: 2, price : 15 }, {_id: 3, price : 12 }] and so on.


I now receive an updated doc from a remote site that that looks like this:


[ { _id: 1, price : 12 }, {_id: 3, price : 15 }, { _id: 5, price: 20 } ] (some new some updated).


How can I change my data to



  1. update exiting records

  2. insert the new records.


Thank you in advance.



asked 55 secs ago







Mongodb: updating multiple docs w/different values

Aucun commentaire:

Enregistrer un commentaire