diff --git a/DataCollector/CommandDataCollector.php b/DataCollector/CommandDataCollector.php index 7389ae93..c36fd310 100644 --- a/DataCollector/CommandDataCollector.php +++ b/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 since version 4.7.0 */ 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(), ]; }, diff --git a/composer.json b/composer.json index be732051..cffca340 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", "doctrine/annotations": "^1.13 || ^2.0", "doctrine/mongodb-odm": "^2.3", "doctrine/persistence": "^2.2 || ^3.0",