我正在尝试编写通用查询来更新attempts1
字段
{
"_id" : ObjectId("59d659eb9d492019f018cf14"),
"_class" : "com.anthem.twofatoggleattemptevent.mongo.collections.abc",
"masterCollection1" : {
"version" : "1.0",
"keys" : [
{
"type" : "test",
"value" : "636T90012~1985-01-01~Mohan~test"
},
{
"type" : "usernm",
"value" : "~AF99990865"
},
{
"type" : "webguid",
"value" : "25e03606-da67-448a-8ece-881829b95daa"
}
],
"events" : [
{
"_id" : ObjectId("59d659eb9d492019f018cf13"),
"eventType" : {
"code" : "Test-UAT",
"desc" : "Test"
},
"eventSrc" : "Toggle_Indvidual",
"suggestedAction" : "Test",
"effectiveDt" : ISODate("2017-01-01T05:00:00.000Z"),
"terminationDt" : Date(253402232400000)
},
{
"_id" : ObjectId("59d65a1a9d492019f018cf16"),
"eventType" : {
"code" : "Test-UAT",
"desc" : "Test"
},
"eventSrc" : "Toggle_Indvidual",
"suggestedAction" : "Test",
"effectiveDt" : ISODate("2017-01-01T05:00:00.000Z"),
"terminationDt" : Date(253402232400000)
},
{
"_id" : ObjectId("59d65ac49d492019f018cf18"),
"eventType" : {
"code" : "Test-UAT",
"desc" : "Test"
},
"eventSrc" : "Toggle_Indvidual",
"suggestedAction" : "Test",
"effectiveDt" : ISODate("2017-01-01T05:00:00.000Z"),
"terminationDt" : Date(253402232400000)
},
{
"_id" : ObjectId("59d65b8d9d492019f018cf1a"),
"eventType" : {
"code" : "Test-UAT",
"desc" : "Test"
},
"eventSrc" : "Toggle_Indvidual",
"suggestedAction" : "Test",
"effectiveDt" : ISODate("2017-01-01T05:00:00.000Z"),
"terminationDt" : Date(253402232400000)
},
{
"_id" : ObjectId("59d65d309d492019f07817fd"),
"eventType" : {
"code" : "Test-UAT",
"desc" : "Test"
},
"eventSrc" : "Toggle_Indvidual",
"suggestedAction" : "Test",
"effectiveDt" : ISODate("2017-01-01T05:00:00.000Z"),
"terminationDt" : Date(253402232400000)
}
],
"attempts1" : [
{
"_id" : ObjectId("59dbbdb2c6700e1b08261059"),
"type" : "001",
"desc" : "Defer",
"count" : 1,
"srcType" : "Login-contactUpdate"
},
{
"_id" : ObjectId("59dbc884c6700e1b08b571d4"),
"type" : "002",
"desc" : "Confirm",
"count" : 1,
"srcType" : "Login-contactUpdate"
},
{
"_id" : ObjectId("59dbcc8bc6700e1b08b571d7"),
"type" : "003",
"desc" : "Update",
"count" : 1,
"srcType" : "Login-contactUpdate"
}
]
}
}
以下查询适用于我,但我想要完整查询此作业。
update({"masterCollection1" : {$exists: true}},{$set: { "masterCollection1.attempts1.0.type" : "444444" }}, {multi: true }