我想通过responsaveis.$
(daniela.morais@sofist.com.br) 获取数组的特定元素但没有结果,我的语法有问题吗?
{
"_id" : ObjectId("54fa059ce4b01b3e086c83e9"),
"agencia" : "Abc",
"instancia" : "dentsuaegis",
"cliente" : "Samsung",
"nomeCampanha" : "Serie A",
"ativa" : true,
"responsaveis" : [
"daniela.morais@sofist.com.br",
"abc@sofist.com.br"
],
"email" : "daniela.morais@sofist.com.br"
}
语法 1
mongoCollection.findAndModify("{'responsaveis.$' : #}", oldUser.get("email"))
.with("{$set : {'responsaveis.$' : # }}", newUser.get("email"))
.returnNew().as(BasicDBObject.class);
语法 2
db.getCollection('validatag_campanhas').find({"responsaveis.$" : "daniela.morais@sofist.com.br"})
结果
Fetched 0 record(s) in 1ms