MongoDB Update (Insert a List of Item to an Array)

后端 未结 5 1698
滥情空心
滥情空心 2021-01-02 16:12

I want to add several items to arrays of several rows in Mongo. How can I do this?

I want to start with this:

{\'x\': \'h\', arr: [1,2,3] }
{\'x\':          


        
5条回答
  •  野趣味
    野趣味 (楼主)
    2021-01-02 16:44

    I think what you are looking for is the $pushAll operator. Take a look here:

    http://docs.mongodb.org/manual/reference/operator/pushAll/#pushall

提交回复
热议问题