Skip to content

Couchbase\Bucket::query #21

@mitgath

Description

@mitgath

Couchbase\Bucket::query($query, $jsonAsArray = false) method
doesn't respect $jsonAsArray param
and always return stdClass object
it works correctly in 2.2.4 and works incorectly in all versions above that

code:

$cluster = new \CouchbaseCluster($dsn);
$bucket = $cluster->openBucket($config['bucket'], $config['password']);

$query = \CouchbaseViewQuery::from('media_event', 'aggregate')
    ->reduce(true)
    ->group(true)
    ->range([$clientName, $from->format('Y-m-d')], [$clientName, $to->format('Y-m-d')], true);

$result = $bucket->query($query, true);
var_dump($result);

$result = $bucket->query($query, false);
var_dump($result);

produces:

object(stdClass)#2435 (1) {
  ["rows"]=>
  array(0) {
  }
}
object(stdClass)#2435 (1) {
  ["rows"]=>
  array(0) {
  }
}

but should be:

array(1) {
  ["rows"]=>
  array(0) {
  }
}
object(stdClass)#2435 (1) {
  ["rows"]=>
  array(0) {
  }
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions