Reputation: 51
Below is the structure I've been working. Criteria is something like I want to update status of nodeName present in Node2 in a single query.
"nodeList": [
{
"nodeName": "Node1",
"status": "Not Ready"
},
{
"nodeName": "Node2",
"status": "Ready"
},
{
"nodeName": "Node3",
"status": "Ready"
}
]
Appreciate your help!!
Upvotes: 1
Views: 625
Reputation: 123
Try this 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)
})
});
Upvotes: 2