Using branch update logic in rethinkdb. I am needing to update a value based on wether another value matches and then set the appropriate value. If the values are the same it should use the existing value.
r.db('testdb').table('great_table').get(1).update(source => {
return r.branch(source('some_other_id').eq(1), {read: false}, /* use existing value */);
})
Tried the following:
r.db('testdb').table('great_table').get(1).update(source => {
return r.branch(source('some_other_id').eq(1), {read: false}, source('checked'));
})
The error I received when I tried this is:
{
"deleted": 0 ,
"errors": 1 ,
"first_error": "Inserted value must be an OBJECT (got BOOL): false" ,
"inserted": 0 ,
"replaced": 0 ,
"skipped": 0 ,
"unchanged": 0
}