The query method must return an iterator and not an array for memory usage when you get very large number of rows.
There is no such option to stream rows on the fly like on MySQL, so we can’t do that.
So close this request
But returning an iterator instead of the array would be nice anyways. You could provide more information in properties to that iterator and could directly loop over the rows without having to ask for the rows explicitly.
You could then write
foreach ($cb->query(CouchbaseViewQuery::from("foo", "bar")) as $row) {
}
Instead of …
$res = $cb->query(CouchbaseViewQuery::from("foo", "bar"));
foreach ($res['rows'] as $row) {
}
So … you would skip that rows
array-attribute It gives you more the mind of working with objects intead of plain data - like you -kind-of- know what you get. Not just “an array”.
Indeed, I’ll make a PR about that.
CouchbaseResult is now Countable