I am developing a web application using Codeigniter and MongoDB. Users can upload files, and other users can comment on them.
I store comments in an array with comments in the main document file. Everything is fine, but how can I remove specific comments from an array?
I can not use ID as a key, since the user can add several comments. How would you recommend me to do this?
This is my array of comments:
"comments": [ { "user_id": ObjectId("4f240b433dc7937d68030000"), "user_name": "james", "user_comment": "This is a comment", "created_at": "2012-01-2821: 20: 44" }, { "user_id": ObjectId("4f240b433dc7937d68030000"), "user_name": "mandy", "user_comment": "This is another comment", "created_at": "2012-01-2821: 31: 07" } ],
mongodb codeigniter
Jonathan Clark Jan 28 2018-12-12T00: 00Z
source share