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
Post a Comment