diff --git a/src/MongoClient.php b/src/MongoClient.php index 1c1426983d..f34df4f06b 100644 --- a/src/MongoClient.php +++ b/src/MongoClient.php @@ -95,7 +95,6 @@ class MongoClient $sections = BSON\fromPHP($params); $message = pack('V*', 21 + strlen($sections), $this->id, 0, 2013, 0) . "\0" . $sections; - return $this->send($message); } @@ -119,11 +118,15 @@ class MongoClient * Send a message to connection. * * @param mixed $data + * @return stdClass|array|int + * @throws DuplicateException */ public function send(mixed $data): stdClass|array|int { $this->client->send($data); - return $this->receive(); + $res = $this->receive(); + //var_dump($res); + return $res; } /** diff --git a/tests/MongoTest.php b/tests/MongoTest.php index 96abb6522a..feffe57bed 100644 --- a/tests/MongoTest.php +++ b/tests/MongoTest.php @@ -54,10 +54,11 @@ class MongoTest extends TestCase 'language' => 'English' ] ); + self::assertEquals(24, strlen((string)$doc['_id'])); - var_dump($doc['_id']); - $this->getDatabase()->insert('movies', ['9 Monkeys']); + $doc = $this->getDatabase()->insert('movies', ['9 Monkeys']); + self::assertEquals(24, strlen((string)$doc['_id'])); }