How to get metrics within the result of N1QL query through PHP SDK


I have this example where the results contains only the rows, how to find metrics where I need to get rows count of all results

$myBucket = $myCluster->openBucket();
$query = CouchbaseN1qlQuery::fromString('SELECT * FROM default limit 10');
$res = $myBucket->query($query);

anybody can help please ?!


@bashar, this functionality is not exposed yet, but if you like, you can use the following approach now (note that it is using internal interfaces, which are private and might change without notice)

$r = new ReflectionClass('CouchbaseBucket');
$private_interface = $r->getProperty('me');

$h = new CouchbaseCluster('couchbase://localhost');
$b = $h->openBucket('travel-sample');

$query = json_encode(CouchbaseN1qlQuery::fromString('SELECT * FROM `travel-sample` limit 10')->toObject(), true);
$res = $private_interface->getValue($b)->n1ql_request($query, true);
$meta = json_decode($res['meta'], true);
$rows = array();
foreach ($res['results'] as $row) {
    $rows[] = json_decode($row, true);