Info
Hello All,
I have a similar situation I guess, the following is the sample Json document in which I need to query on.
{
"_id" : ObjectId("591d601fc9f360331cd4668c"),
"Type" : "district",
"GroupId" : "00000000-0000-0000-0000-000000000456",
"Grades" : [
{
"GroupId" : "gs00000000-0000-0000-0000-000000000452",
"Categories" : [
{
"Sequence" : 1,
"Low" : 0,
"High" : 99,
"Min" : 0,
"Max" : 0,
},
{
"Sequence" : 1,
"Low" : 50,
"High" : 99,
"Min" : 0,
"Max" : 0,
}
]
}
],
"NumberOfTypes" : 4,
"CreatedDate" : ISODate("2017-05-18T08:49:35.433Z"),
"LastModifiedDate" : ISODate("2017-05-26T16:12:52.093Z"),
"Status" : true
}
I need to pick all the document where the value of "Low": 0 and change to 1. I am trying the following query
db.BenchmarkDetails.update(
{"Grades.Categories.Low" : 0},
{$set :
{"Grades.Categories.$.Low" : 1}
}
)
This throwing the error
cannot use the part (Grades of Grades.Categories.0.Low) to traverse the element.
Top User Comments
thomas.schubert commented on Fri, 9 Jun 2017 15:10:02 +0000:
Hi katakam.maniratnam@gmail.com,
Thanks for your reporting this issue. We're working on improving array updates for MongoDB 3.6. Please free feel to watch SERVER-27089 for updates. See also the conversation on SERVER-29515 regarding recent work in this space.
Thanks again,
Thomas