Template
single collection
multiple collections
mgodatagen
update
indexe
explain
Stage
Database
bson
mgodatagen
[{A:"a",B:"b",C:[{name:"cat",type:"animal"},{name:"jonh",type:"human"}]}]
Query
db.collection.aggregate([{"$set":{"C":{"$filter":{"input":"$C","cond":{"$eq":["$$this.type","animal"]}}}}}])
Result