mongodb - How to update a field value in array in mongo database? -
how can update value 'enabled' field in configuration @ index 1 in configurations array in mongo
database ?
below json
data.
{ "configurations" : [ { "configuration" : { "host" : "", "port" : "1521", "enabled" : "true" } }, { "configuration" : { "host" : "", "port" : "", "enabled" : "true" } } ], "description" : "check database server" }
is there way update value enabled field in configuration ?? how can update value 'enabled'
field in configuration @ index 1 in configurations array in mongodba
?
i want update enabled field value of 2nd configuration in configurations array.
what this
db.collection.update({}, { "$set": { "configurations.1.configuration.enabled": false }} )