Rethinkdb Use existing value if branch evaluates to false

238
August 10, 2017, at 00:20 AM

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
}
Rent Charter Buses Company
READ ALSO
Alternative or help for multiple SQL queries running too slow

Alternative or help for multiple SQL queries running too slow

On one single page, I do have about 100 queries like

286
Curl not responding

Curl not responding

I'm developing a module in prestashop and i need to download a XML by curl

347
Curl -x -h -d API

Curl -x -h -d API

I'm trying to test the basics of this https://developerclarifai

481
PHP check if multiple file upload is empty

PHP check if multiple file upload is empty

In my code you have a choice of either uploading a file or not and if you don't it should just end the code, but if you do upload a file and select an appropriate pack name(which is a database name they created) then it is suppose to run the code and submit...

427