Search code examples
phprethinkdb

rethinkdb or where query on php driver


I'm using rethinkdb PHP driver and I'm trying to perform an or where query, below is what I've tried

$query = r\db('cn_chat')->table('messages')->filter(
         r\row('origin')->eq('connectnigeria')->or(r\row('origin')->eq('business'))
        )->run($conn);

But no luck, any help, ideas please.

it returns

Fatal error: Call to undefined method r\Queries\Math\Eq::or()


Solution

  • According the documentation you attached (http://danielmewes.dnsalias.net/~daniel/php-rql-api/#Math+and+logic),

    the or should be rOr:

    $query = r\db('cn_chat')->table('messages')->filter(
         r\row('origin')->eq('connectnigeria')->rOr(r\row('origin')->eq('business'))
        )->run($conn);