mongodb\Query each()

each() public method (available since version 2.1)

Starts a batch query and retrieves data row by row.

This method is similar to batch() except that in each iteration of the result, only one row of data is returned. For example,

$query = (new Query)->from('user');
foreach ($query->each() as $row) {
}
public yii\mongodb\BatchQueryResult each ( $batchSize = 100, $db = null )
$batchSize integer

The number of records to be fetched in each batch.

$db yii\mongodb\Connection

The MongoDB connection. If not set, the "mongodb" application component will be used.

return yii\mongodb\BatchQueryResult

The batch query result. It implements the Iterator interface and can be traversed to retrieve the data in batches.

doc_Yii
2016-10-30 17:08:57
Comments
Leave a Comment

Please login to continue.