[
{
customer: {
field 1: {},
field 2: {},
answers: {
"BUSI_EXP": { "answered": true, "updated": "date" },
"NEW_HOME": { "answered": true, "updated": "date" },
"VEHICLE": { "answered": true, "updated": "date" }
}
}
},
{
customer: {
field 1: {},
field 2: {},
answers: {
"BUSI_EXP": { "answered": false, "updated": "date" },
"NEW_HOME": { "answered": false, "updated": "date" },
"VEHICLE": { "answered": true, "updated": "date" }
}
}
}
]
这是我的客户系列。如您所见,它有一个答案字段,每个键都有一个回答标记。我如何让所有回答任何答案的客户都是真的?
答案 0 :(得分:2)
尝试:
db.collectionname.find({ $or:[{"customer.answers.BUSI_EXP.answered": true},
{"customer.answers.NEW_HOME.answered": true},
{"customer.answers.VEHICLE.answered": true}});