Open
Description
I was trying to run this query which works perfectly on RethinkDB's Query Browser and JS Driver:
r.branch(
r.expr(x).match('^avg'),
r.expr(r.table('test')('statistics')(x).avg()),
r.expr(x).match('lg'),
r.expr(r.table('test')('statistics')(x).max()),
r.expr(r.table('test')('statistics')(x).sum())
)
But in PHP when the first test was false I was getting the result of 'match'. The only workaround I found was to nest another 'branch' sentence in my PHP query:
r\branch(
r\expr($x)->match('^avg'),
r\expr(r\table('test')->getField('statistics')->getField($x)->avg()),
r\branch(
r\expr($x)->match('lg'),
r\expr(r\table('test')->getField('statistics')->getField($x)->max()),
r\expr(r\table('test')->getField('statistics')->getField($x)->sum())
)
)
In RethinkDB's docs and on PHP-RQL ones it is stated that 'Branch' works with 2n +1 arguments which is not the case on the current PHP implementation.
Metadata
Metadata
Assignees
Labels
No labels