Update multiple documents by providing documents in body, mongoose/mongodb

前端 未结 1 1952
小蘑菇
小蘑菇 2021-02-08 08:09

I need to update several documents by providing them in the body. I can\'t query them, they must be provided.

Example:

 var persons = [
    {id: 1, name         


        
1条回答
  •  故里飘歌
    2021-02-08 08:30

    Try using the update command along with the "$in" operator:

    var ids= [];
    for (var i=0 i

    Hope this helps

    0 讨论(0)
提交回复
热议问题