Now, if we want to retrieve data against field friends from document with _id xyz123, it can be done with the help of below code snippet:
The output produced on console is:
Now, in our friends field, we have data as "andy", "John" and "Amit". If we want to remove "John" from the list, we can with the help of the below code.
The output of the query is:
"John" is removed from the field friends.