0

使用 mongo-php-library ,https://github.com/mongodb/mongo-php-library 这是php文件的内容:

<?php 

    include_once __DIR__. '/vendor/autoload.php';

    $db = (new MongoDB\Client("mongodb://192.168.1.49:27019"))->selectDatabase("DB");

    $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);

        }
    }

我已经搜索但找到了任何与之相关的解决方案。是什么原因?

4

0 回答 0