0
我是MongoDB的新手。我已經存儲在以下格式如何更新MongoDB中的特定數組元素
"_id" : ObjectId("51d5725c7be2c20819ac8a22"),
"chrom" : "chr22",
"pos" : 17060409,
"information" : [
{
"name" : "Category",
"value" : "3"
},
{
"name" : "INDEL",
"value" : "INDEL"
},
{
"name" : "DP",
"value" : "31"
},
{
"name" : "FORMAT",
"value" : "GT:PL:GQ"
},
{
"name" : "PV4",
"value" : "1,0.21,0.00096,1"
}
],
"sampleID" : "Job1373964150558382243283"
我想更新價值11其名稱爲Category
內MongoDB的數據。 我曾嘗試下面的查詢:
db.VariantEntries.update({$and:[ { "pos" : 117199533} , { "sampleID" : "Job1373964150558382243283"},{"information.name":"Category"}]},{$set:{'information.value':'11'}})
但蒙戈回覆
can't append to array using string field name [value]
怎樣才能形成一個查詢將更新特定的價值?
你有沒有看着http://stackoverflow.com/questions/13040344/cant-append-to-array-using-string-field-name-when-performing-update -on-ARRA –