Set multiple fields with one update query

前端 未结 1 1384
你的背包
你的背包 2021-01-07 13:07

The following code should work. I could have missed something, but right now I have it as 2 separate update statements and have decided to ask here why this line isn\'t work

1条回答
  •  小鲜肉
    小鲜肉 (楼主)
    2021-01-07 13:25

    The third argument to MongoCollection::update is an array of options for the update operation.

    $this->db->settings->update(
        array('_id' => $mongoID),
        array('$set' => array('about' => $about, 'avatar' => $avatar))
    );
    

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