I'm new to Mongo and thus trying to implement a use-case wherein I need to build a query to remove data from an array from inside a collection of documents.
Here is one of my documents:
{
"id" : 2,
"owners" : ["aa", "bb"]
}
Now I need to build a query to find all document records based on the owners and if present, remove them from the owners array.
For example, I sent aa in the query, then I need to remove that from all the documents that contains that owner.
I found somewhere this logic:
$db.coll.update({cond to identify document},{$pull:{'owners':{'aa':<>}}})
But don't understand how does this remove the data. Thanks in advance!