Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Why don't support startAfter field ? #818

Closed
@xyxsns

Description

Bug Report

What reason is this?

Environment

php -i | grep -E 'mongodb|libmongoc|libbson'

mongodb
libbson bundled version => 1.16.2
libmongoc bundled version => 1.16.2
libmongoc SSL => enabled
libmongoc SSL library => Secure Transport
libmongoc crypto => enabled
libmongoc crypto library => Common Crypto
libmongoc crypto system profile => disabled
libmongoc SASL => enabled
libmongoc ICU => disabled
libmongoc compression => enabled
libmongoc compression snappy => disabled
libmongoc compression zlib => enabled
libmongocrypt bundled version => 1.0.3
libmongocrypt crypto => enabled
libmongocrypt crypto library => Common Crypto
mongodb.debug => no value => no value

composer show mongodb/mongodb

name : mongodb/mongodb
descrip. : MongoDB driver library
keywords : database, driver, mongodb, persistence
versions : * 1.6.1
type : library
license : Apache License 2.0 (Apache-2.0) (OSI approved) https://spdx.org/licenses/Apache-2.0.html#licenseText
homepage : https://jira.mongodb.org/browse/PHPLIB
source : [git] https://github.com/mongodb/mongo-php-library.git 4bb040c
dist : [zip] https://api.github.com/repos/mongodb/mongo-php-library/zipball/4bb040c620ab95c487d05d5ff50cbc92fa68e920 4bb040c
path : /private/var/www/zfy/soa/vendor/mongodb/mongodb
names : mongodb/mongodb

autoload
psr-4
MongoDB\ => src/
files

requires
ext-hash *
ext-json *
ext-mongodb ^1.7
php ^5.6 || ^7.0

requires (dev)
phpunit/phpunit ^5.7.27 || ^6.4 || ^8.3
sebastian/comparator ^1.0 || ^2.0 || ^3.0
squizlabs/php_codesniffer ^3.4
symfony/phpunit-bridge ^4.4@dev

Test Script

<?php 
 include_once __DIR__. '/vendor/autoload.php';
 $db = (new MongoDB\Client("mongodb://192.168.1.49:27019"))->selectDatabase("zfy");
 $changeStream = $db -> selectCollection("demo") ->watch([], ['fullDocument' => MongoDB\Operation\Watch::FULL_DOCUMENT_UPDATE_LOOKUP]);
 $changeStream = $db -> selectCollection("demo")
 ->watch([],
 [
 'startAfter'=>(object)["_id"=>["_data"=>"82605DCA8B000000012B022C0100296E5A100401BA8F24F40446978F73B0856BF3FC6D46645F696400645F68549CB505DF3AA77DD50A0004"]],
 'fullDocument' => MongoDB\Operation\Watch::FULL_DOCUMENT_UPDATE_LOOKUP]);
 while (true) {
 $changeStream->next();
 if ($changeStream->valid()) {
 $nextChange = $changeStream->current();
 echo json_encode($nextChange);
 }
 }

Expected and Actual Behavior

Nothing

Debug Log

Fatal error: Uncaught MongoDB\Driver\Exception\CommandException: BSON field '$changeStream.startAfter' is an unknown field. in /private/var/www/mongo-changestream-php-master/vendor/mongodb/mongodb/src/Operation/Aggregate.php:295
Stack trace:
#0 /private/var/www/mongo-changestream-php-master/vendor/mongodb/mongodb/src/Operation/Aggregate.php(295): MongoDB\Driver\Server->executeReadCommand('zfy', Object(MongoDB\Driver\Command), Array)
#1 /private/var/www/mongo-changestream-php-master/vendor/mongodb/mongodb/src/Operation/Watch.php(337): MongoDB\Operation\Aggregate->execute(Object(MongoDB\Driver\Server))
#2 /private/var/www/mongo-changestream-php-master/vendor/mongodb/mongodb/src/Operation/Watch.php(316): MongoDB\Operation\Watch->executeAggregate(Object(MongoDB\Driver\Server))
#3 /private/var/www/mongo-changestream-php-master/vendor/mongodb/mongodb/src/Operation/Watch.php(285): MongoDB\Operation\Watch->createChangeStreamIterator(Object(MongoDB\Driver\Server))
#4 /private/var/www/mongo-changestream-php-master/vendor/mongodb/mo in /private/var/www/mongo-changestream-php-master/vendor/mongodb/mongodb/src/Operation/Aggregate.php on line 295

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions

        AltStyle によって変換されたページ (->オリジナル) /