Within my mongo collection, I have a nested variable of called "institution.type". This is an array with the following elements:
db.collection.distinct("institution.type")
[
null,
[
"boarding"
],
"virtual"
]
I am trying to remove the entries with the "boarding" element, however am getting stuck due to the fact that boarding itself is within an array ( a mistake initially made when using "$push" to an array)
I have tried the following to find the documents:
db.collection.find({"institution.type":{ $in: ["boarding"]}}).count()
0
and
db.collection.update({"institution.id":"somenumber"}, {$pull: {"institution.type.1":"boarding"}})
"type" : [
"virtual",
[ ]
]
How can I remove the brackets along with the "boarding" tag without getting the error of
JavaScript execution failed: SyntaxError: Unexpected identifier ?
Any advice would be greatly appreciated and welcomed!