diff --git a/composer.json b/composer.json index 626c5655..929c2ab0 100644 --- a/composer.json +++ b/composer.json @@ -25,7 +25,7 @@ "homepage": "http://www.doctrine-project.org", "require": { "php": "^8.1", - "ext-mongodb": "^1.5", + "ext-mongodb": "^1.16", "composer-runtime-api": "^2.0", "doctrine/mongodb-odm": "^2.6", "doctrine/persistence": "^3.0", diff --git a/src/DataCollector/CommandDataCollector.php b/src/DataCollector/CommandDataCollector.php index cade11ca..7530d8a5 100644 --- a/src/DataCollector/CommandDataCollector.php +++ b/src/DataCollector/CommandDataCollector.php @@ -6,6 +6,7 @@ use Doctrine\ODM\MongoDB\APM\Command; use Doctrine\ODM\MongoDB\APM\CommandLogger; +use MongoDB\BSON\Document; use stdClass; use Symfony\Component\HttpFoundation\Request; use Symfony\Component\HttpFoundation\Response; @@ -16,8 +17,6 @@ use function array_reduce; use function count; use function json_decode; -use function MongoDB\BSON\fromPHP; -use function MongoDB\BSON\toCanonicalExtendedJSON; /** @internal */ final class CommandDataCollector extends DataCollector @@ -33,10 +32,11 @@ public function collect(Request $request, Response $response, ?Throwable $except 'commands' => array_map( static function (Command $command): array { $dbProperty = '$db'; + $document = Document::fromPHP($command->getCommand()); return [ 'database' => $command->getCommand()->$dbProperty ?? '', - 'command' => json_decode(toCanonicalExtendedJSON(fromPHP($command->getCommand()))), + 'command' => json_decode($document->toCanonicalExtendedJSON()), 'durationMicros' => $command->getDurationMicros(), ]; },