Helloo guys,
i have in mongo db collection:
{
"_id" : "aghpbF6xxxCyMGg9J",
"description" : "",
"name" : "test",
"roles" : [
"ab.read",
"test.view"
],
"type" : "group"
}
and i have testRoles object:
[ { name: 'testRoles',
permissions: [ 'ab.write', 'test.check' ] } ],
and basically what i need to do is, replace field roles in db with field permissions from testRoles object, please anybody can help me manage it please?
You can simply $set the desired field and replace the entire array like this: