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 }} ) 

Popular posts from this blog

c# - ODP.NET Oracle.ManagedDataAccess causes ORA-12537 network session end of file -

matlab - Compression and Decompression of ECG Signal using HUFFMAN ALGORITHM -

utf 8 - split utf-8 string into bytes in python -