|
MongoDB\Driver\Cursor::toArrayReturns an array containing all results for this cursor Beschreibung
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. Parameter-ListeDiese Funktion hat keine Parameter. RückgabewerteReturns an array containing all results for this cursor. Fehler/Exceptions
BeispieleBeispiel #1 MongoDB\Driver\Cursor::toArray example
<?phpDas oben gezeigte Beispiel erzeugt eine ähnliche Ausgabe wie:
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)
}
}
Siehe auch
|