rethinkdb update query with nested array of objects -


below structure i've been working. criteria want update status of nodename present in node2 in single query.

"nodelist": [   {     "nodename": "node1",     "status": "not ready"   },   {     "nodename": "node2",     "status": "ready"   },   {     "nodename": "node3",     "status": "ready"   } ] 

appreciate help!!

try query:-

r.db("your_database").table("your_table_name") .get('id') .update({               nodelist: r.row('nodelist').map(function (newstatus) {           return r.branch(           newstatus('nodename').eq('field_value'),                                                     newstatus.merge({status: 'new value'}),newstatus)         }) 

});


Comments

Popular posts from this blog

php - Vagrant up error - Uncaught Reflection Exception: Class DOMDocument does not exist -

vue.js - Create hooks for automated testing -

Add new key value to json node in java -