PHP » GoLang |
login |
register |
about
|
GoLang MongoDB\Driver\Cursor::toArray
request it (484)
GoLang replacement for PHP's MongoDB\Driver\Cursor::toArray
[edit | history]
PHP MongoDB\Driver\Cursor::toArrayPHP original manual for MongoDB\Driver\Cursor::toArray [ show | php.net ]MongoDB\Driver\Cursor::toArray(mongodb >=1.0.0) MongoDB\Driver\Cursor::toArray — Returns an array containing all results for this cursor Description
final public array MongoDB\Driver\Cursor::toArray
( void
)
Iterates the cursor and returns its results in an array. MongoDB\Driver\Cursor::setTypeMap() may be used to control how documents are unserialized into PHP values. ParametersThis function has no parameters. Return ValuesReturns an array containing all results for this cursor. Errors/Exceptions
ExamplesExample #1 MongoDB\Driver\Cursor::toArray() example
<?phpThe above example will output something similar to:
array(3) {
[0]=>
object(stdClass)#6 (2) {
["_id"]=>
object(MongoDB\BSON\ObjectId)#5 (1) {
["oid"]=>
string(24) "564259a96118fd40b41bcf61"
}
["x"]=>
int(1)
}
[1]=>
object(stdClass)#8 (2) {
["_id"]=>
object(MongoDB\BSON\ObjectId)#7 (1) {
["oid"]=>
string(24) "564259a96118fd40b41bcf62"
}
["x"]=>
int(2)
}
[2]=>
object(stdClass)#10 (2) {
["_id"]=>
object(MongoDB\BSON\ObjectId)#9 (1) {
["oid"]=>
string(24) "564259a96118fd40b41bcf63"
}
["x"]=>
int(3)
}
}
See Also
|
more
Most requested
more
Last requests
|