I have been searching all day to figure out how to do a simple delete for one element inside a document that is inside a collection. I am fairly new to mongo scripts so bear with me.
I am currently using this script to see a certain document:
db.getCollection('roles').deleteOne({"_id": "e9b4afad-cb5c-4588-9560-161867faa5b7"})
This is what the document shows in Robo3T after the it is executed:
{
"_id" : "e9b4afad-cb5c-4588-9560-161867faa5b7",
"appIds" : [
"rpt",
"wc",
"bw"
],
}
I am simply wanting to remove "rpt" from appIds. I have tried this so far and it doesn't work:
db.getCollection('roles').find({"_id": "e9b4afad-cb5c-4588-9560-161867faa5b7"}).remove({"appIds": "rpt"})
Any documentation that'll point me in the right direction?
Thanks!