Removing specific items from array with MongoDB

前端 未结 3 1214
后悔当初
后悔当初 2020-11-28 09:21

I am developing a web app using Codeigniter and MongoDB. The users can upload files and other users can comment on them.

I store the comments in an array called comm

3条回答
  •  無奈伤痛
    2020-11-28 09:41

    maybe you can remove comment by its 'created_at' time, as the time is unique.

    $db.coll.update({cond to identify document},{$pull:{'comments':{'created_at':<>}}})
    

提交回复
热议问题