We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
<?php include "vendor/autoload.php"; $client = new MongoClient('mongodb://127.0.0.1:27017'); $test1 = $client->selectCollection('test', 'test1'); $test2 = $client->selectCollection('test', 'test2'); $test1->drop(); $test2->drop(); for ($i = 0; $i < 5; $i ++) { $inertData = array( 'a' => $i, 'b' => time() ); var_dump($test1->insert($inertData)); $inertData1 = array( 'a' => $i, 'b' => time() ); var_dump($test2->insert($inertData1)); } $cursor = $test1->find([],['a'=>true]); $cursor->limit(10); $cursor->sort(array( '_id' => - 1 )); $data = array(); while ($cursor->hasNext()) { $row = $cursor->getNext(); $test2->count(array( 'a' => $row['a'] )); $data[] = $row; } var_dump($data);
**# the correct result is a from 0 to 4
but the real result is : double 3 like this:**
array(5) { [0]=> array(2) { ["_id"]=> object(MongoId)#43 (1) { ["objectID":"MongoId":private]=> object(MongoDB\BSON\ObjectID)#36 (1) { ["oid"]=> string(24) "5704d1c991a65e2384002817" } } ["a"]=> int(3) } [1]=> array(2) { ["_id"]=> object(MongoId)#48 (1) { ["objectID":"MongoId":private]=> object(MongoDB\BSON\ObjectID)#47 (1) { ["oid"]=> string(24) "5704d1c991a65e2384002817" } } ["a"]=> int(3) } [2]=> array(2) { ["_id"]=> object(MongoId)#45 (1) { ["objectID":"MongoId":private]=> object(MongoDB\BSON\ObjectID)#44 (1) { ["oid"]=> string(24) "5704d1c991a65e2384002815" } } ["a"]=> int(2) } [3]=> array(2) { ["_id"]=> object(MongoId)#52 (1) { ["objectID":"MongoId":private]=> object(MongoDB\BSON\ObjectID)#51 (1) { ["oid"]=> string(24) "5704d1c991a65e2384002813" } } ["a"]=> int(1) } [4]=> array(2) { ["_id"]=> object(MongoId)#54 (1) { ["objectID":"MongoId":private]=> object(MongoDB\BSON\ObjectID)#53 (1) { ["oid"]=> string(24) "5704d1c991a65e2384002811" } } ["a"]=> int(0) } }
The text was updated successfully, but these errors were encountered:
All hasNext() getNext() will triggering this bug.
Sorry, something went wrong.
Thanks for the example! This will be fixed in 1.0.2.
0b27c0e
No branches or pull requests
**# the correct result is a from 0 to 4
but the real result is :
double 3 like this:**
The text was updated successfully, but these errors were encountered: