例如,我们在集合测试中有文档。
>> db.test.find()
{ name: abc, child: [ {name: child1, age:10},
{name: child2, age:20},
{name: child3, age:30} ]}
{ name: abcd, child: [ {name: child1, age:10},
{name: child2, age:20},
{name: child3, age:30} ]}
我想从第一个文档中的子集中删除年龄等于 10 的那个。我该怎么做?预期的结果应该是:
{ name: abc, child: [ {name: child2, age:20},
{name: child3, age:30} ]}
{ name: abcd, child: [ {name: child1, age:10},
{name: child2, age:20},
{name: child3, age:30} ]}