way to update multiple documents with different values

后端 未结 4 1197
再見小時候
再見小時候 2021-01-17 08:41

I have the following documents:

[{
  \"_id\":1,
  \"name\":\"john\",
  \"position\":1
},
 {\"_id\":2,
  \"name\":\"bob\",
  \"position\":2
},
 {\"_id\":3,
           


        
4条回答
  •  时光取名叫无心
    2021-01-17 09:09

    You can use db.collection.bulkWrite() to perform multiple operations in bulk. It has been available since 3.2.

    It is possible to perform operations out of order to increase performance.

提交回复
热议问题