{
"Time" : 1527059445,
"UID" : "user-id-1",
"Hit" : 23,
"Properties" : [
{
"Key" : "Name",
"Value": "John"
},
{
"Key": "Age",
"Value": 23
}
]
}db.getCollection('testcollection').updateMany(
{
"UID": "user-id-1",
"Properties.Key" : "Name"
},
{
$set : {
"Properties.$.Value" : "xyz"
}
}
)Hi
I tried the operation you posted on MongoDB 3.2.18 and was able to perform the update with no error in the mongo shell:
> db.version()
3.2.18
> db.test.find()
{
"_id": ObjectId("5b063da4061942f6f05dc33d"),
"Time": 1527059445,
"UID": "user-id-1",
"Hit": 23,
"Properties": [
{
"Key": "Name",
"Value": "John"
},
{
"Key": "Age",
"Value": 23
}
]
}
> db.test.updateMany(
... {
... "UID": "user-id-1",
... "Properties.Key" : "Name"
... },
... {
... $set : {
... "Properties.$.Value" : "xyz"
... }
... }
... )
{
"acknowledged": true,
"matchedCount": 1,
"modifiedCount": 1
}
> db.test.find()
{
"_id": ObjectId("5b063da4061942f6f05dc33d"),
"Time": 1527059445,
"UID": "user-id-1",
"Hit": 23,
"Properties": [
{
"Key": "Name",
"Value": "xyz"
},
{
"Key": "Age",
"Value": 23
}
]
}
Perhaps it’s an issue specific to Robo3T? If you find that this operation still fails, could you post the output of db.version() and mongod --version?
Best regards
Kevin
Hi
Yep. I checked the version and it is 3.2.0
Have you tried the operation with the mongo shell? Was it successful?
Best regards
Kevin