MongoDB\Driver\CursorId::__toString

(mongodb >=1.0.0)

MongoDB\Driver\CursorId::__toStringString representation of the cursor ID

说明

final public MongoDB\Driver\CursorId::__toString ( void ) : string

Returns the string representation of the cursor ID.

参数

此函数没有参数。

返回值

Returns the string representation of the cursor ID.

范例

Example #1 MongoDB\Driver\CursorId::__toString() example

<?php

/* In this example, we insert several documents into the collection and specify
 * a smaller batchSize to ensure that the first batch contains only a subset of
 * our results and the cursor remains open on the server. */
$manager = new MongoDB\Driver\Manager("mongodb://localhost:27017");
$query = new MongoDB\Driver\Query([], ['batchSize' => 2]);

$bulk = new MongoDB\Driver\BulkWrite;
$bulk->insert(['x' => 1]);
$bulk->insert(['x' => 2]);
$bulk->insert(['x' => 3]);
$manager->executeBulkWrite('db.collection'$bulk);

$cursor $manager->executeQuery('db.collection'$query);
var_dump((string) $cursor->getId());

?>

以上例程的输出类似于:

string(11) "98061641158"

参见

相关文章
php mongodb driver the mongodb driver cursor classphp ktaglib id3v2 frame returns a string representation of the framephp mongodb bson decimal128 returns the string representation of this decimal128php mongodb bson int64 returns the string representation of this int64php mongodb bson regex returns the string representation of this regexphp mongodb bson regexinterface returns the string representation of this regexinterfacephp mongodb bson timestamp returns the string representation of this timestampphp mongodb bson timestampinterface returns the string representation of this timestampinterfacephp mongodb bson utcdatetime returns the string representation of this utcdatetimephp mongodb bson utcdatetimeinterface returns the string representation of this utcdatetimeinterfacephp mongodb driver cursor create a new cursor not used php mongodb driver cursor returns the id for this cursorphp mongodb driver cursorid create a new cursorid not used php mongodb driver cursorid string representation of the cursor idphp mongodb driver monitoring commandfailedevent returns the command s operation idphp mongodb driver monitoring commandfailedevent returns the command s request idphp mongodb driver monitoring commandstartedevent returns the command s operation idphp mongodb driver monitoring commandstartedevent returns the command s request idphp mongodb driver monitoring commandsucceededevent returns the command s operation idphp mongodb driver monitoring commandsucceededevent returns the command s request id
关注编程学问公众号