0
得到删除这是我收集名为学生数组元素不MongoDB中
{
"_id" : 0,
"name" : "aimee Zank",
"scores" : [
{
"type" : "exam",
"score" : 1.46317973670502
},
{
"type" : "quiz",
"score" : 11.7827330995777
},
{
"type" : "homework",
"score" : 6.67617606065462
},
{
"type" : "homework",
"score" : 35.8740349954354
}
]
}
当我运行此,我能够通过布置作业删除×2个阵列元素:
db.students.update(
{ '_id': 0 },
{ $pull: { scores: { type: 'homework' } } },
{ multi: true }
)
但是,当我我试图通过实际得分删除一个数组以及type = Homework, 它不会删除该数组元素。 任何人都可以请帮助,没有得到在任何文件,试图用单引号和双引号等
db.students.update(
{ '_id': 0 },
{ $pull: { scores: { type: 'homework', score: 6.67617606065462 } } },
{ multi: true }
)