From fd8db9118a3ccaf864408b1ba1a7a7db19814d3f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9r=C3=B4me=20Tamarelle?= Date: Tue, 4 Mar 2025 21:50:00 +0100 Subject: [PATCH 01/11] Fix data collector (#23) builderEncoder uses a WeakMap that cannot be serialized --- composer.json | 3 ++- src/DataCollector/MongoDBDataCollector.php | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/composer.json b/composer.json index c2f1ffa..a47bec3 100644 --- a/composer.json +++ b/composer.json @@ -13,7 +13,8 @@ ], "require": { "php": ">=8.1", - "mongodb/mongodb": "^1.17", + "ext-mongodb": "^1.21", + "mongodb/mongodb": "^1.21", "symfony/config": "^6.3 || ^7.0", "symfony/console": "^6.3 || ^7.0", "symfony/dependency-injection": "^6.3.5 || ^7.0", diff --git a/src/DataCollector/MongoDBDataCollector.php b/src/DataCollector/MongoDBDataCollector.php index a14bcd4..c83f24a 100644 --- a/src/DataCollector/MongoDBDataCollector.php +++ b/src/DataCollector/MongoDBDataCollector.php @@ -83,7 +83,7 @@ public function lateCollect(): void (array) $client->getManager()->executeCommand('admin', new Command(['buildInfo' => 1]))->toArray()[0], ['versionArray' => 0, 'ok' => 0], ), - 'clientInfo' => array_diff_key($client->__debugInfo(), ['manager' => 0]), + 'clientInfo' => array_diff_key($client->__debugInfo(), ['manager' => 0, 'builderEncoder' => 0]), ]; } From f37094b47916fdedfc96830ea61d70f365c83b62 Mon Sep 17 00:00:00 2001 From: Oskar Stark Date: Tue, 4 Mar 2025 21:53:35 +0100 Subject: [PATCH 02/11] Use `ramsey/composer-install` action v3 (#21) --- .github/workflows/ci.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 5e68d91..c4ef44e 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -79,7 +79,7 @@ jobs: run: composer require ${{ matrix.variant }} --no-update - name: Install Composer dependencies (${{ matrix.dependencies }}) - uses: ramsey/composer-install@v2 + uses: ramsey/composer-install@v3 with: dependency-versions: ${{ matrix.dependencies }} From 2a303e4adbdad9243ef7817b39c6d82cd2d9a38c Mon Sep 17 00:00:00 2001 From: Oskar Stark Date: Tue, 4 Mar 2025 21:54:00 +0100 Subject: [PATCH 03/11] Use MongoDB 8 in CI (#20) --- .github/workflows/ci.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index c4ef44e..adb39a3 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -18,14 +18,14 @@ jobs: services: mongodb_primary: - image: mongo:7-jammy + image: mongo:8 env: MONGO_INITDB_ROOT_USERNAME: "primary" MONGO_INITDB_ROOT_PASSWORD: "password" ports: - "27017:27017" mongodb_secondary: - image: mongo:7-jammy + image: mongo:8 env: MONGO_INITDB_ROOT_USERNAME: "secondary" MONGO_INITDB_ROOT_PASSWORD: "password" From d48585beefba6d370f004c5b8975fa6511efdd20 Mon Sep 17 00:00:00 2001 From: Oskar Stark Date: Tue, 4 Mar 2025 21:54:24 +0100 Subject: [PATCH 04/11] Require safe symfony/runtime versions (#18) See vulnerability https://github.com/symfony/symfony/security/advisories/GHSA-x8vp-gf4q-mw5j --- composer.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/composer.json b/composer.json index a47bec3..0db6ad0 100644 --- a/composer.json +++ b/composer.json @@ -19,7 +19,7 @@ "symfony/console": "^6.3 || ^7.0", "symfony/dependency-injection": "^6.3.5 || ^7.0", "symfony/http-kernel": "^6.3.5 || ^7.0", - "symfony/runtime": "^6.3 || ^7.0" + "symfony/runtime": "^6.4.14 || ^7.1.7" }, "require-dev": { "doctrine/coding-standard": "^12.0", From db8649f8ea682fd7b873d2234dac7b31ac6c68a9 Mon Sep 17 00:00:00 2001 From: Oskar Stark Date: Tue, 4 Mar 2025 21:54:44 +0100 Subject: [PATCH 05/11] Sort dependencies in `composer.json` (#17) --- composer.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/composer.json b/composer.json index 0db6ad0..8d3535e 100644 --- a/composer.json +++ b/composer.json @@ -29,8 +29,8 @@ "symfony/framework-bundle": "^6.3.5 || ^7.0", "symfony/phpunit-bridge": "~6.3.10 || ^6.4.1 || ^7.0.1", "symfony/stopwatch": "^6.3 || ^7.0", - "symfony/yaml": "^6.3 || ^7.0", "symfony/web-profiler-bundle": "^6.3 || ^7.0", + "symfony/yaml": "^6.3 || ^7.0", "zenstruck/browser": "^1.6" }, "scripts": { From cabfa913e7b6073274bfee7ae0308b10d0f89d96 Mon Sep 17 00:00:00 2001 From: Oskar Stark Date: Tue, 4 Mar 2025 21:55:18 +0100 Subject: [PATCH 06/11] Require `rector/rector` 2 (#16) --- composer.json | 2 +- rector.php | 2 +- src/MongoDBBundle.php | 3 ++- 3 files changed, 4 insertions(+), 3 deletions(-) diff --git a/composer.json b/composer.json index 8d3535e..cba6e6b 100644 --- a/composer.json +++ b/composer.json @@ -23,7 +23,7 @@ }, "require-dev": { "doctrine/coding-standard": "^12.0", - "rector/rector": "^0.18", + "rector/rector": "^2.0", "symfony/browser-kit": "^6.3 || ^7.0", "symfony/filesystem": "^6.3 || ^7.0", "symfony/framework-bundle": "^6.3.5 || ^7.0", diff --git a/rector.php b/rector.php index bb32881..5f72f61 100644 --- a/rector.php +++ b/rector.php @@ -19,9 +19,9 @@ */ use Rector\Config\RectorConfig; -use Rector\Core\ValueObject\PhpVersion; use Rector\Set\ValueObject\LevelSetList; use Rector\Set\ValueObject\SetList; +use Rector\ValueObject\PhpVersion; return static function (RectorConfig $rectorConfig): void { $rectorConfig->parallel(); diff --git a/src/MongoDBBundle.php b/src/MongoDBBundle.php index 5dac19a..a9e1ce6 100644 --- a/src/MongoDBBundle.php +++ b/src/MongoDBBundle.php @@ -20,6 +20,7 @@ namespace MongoDB\Bundle; +use MongoDB\Bundle\DependencyInjection\Compiler\DataCollectorPass; use MongoDB\Bundle\DependencyInjection\MongoDBExtension; use Symfony\Component\DependencyInjection\ContainerBuilder; use Symfony\Component\DependencyInjection\Extension\ExtensionInterface; @@ -34,6 +35,6 @@ public function getContainerExtension(): ?ExtensionInterface public function build(ContainerBuilder $container): void { - $container->addCompilerPass(new DependencyInjection\Compiler\DataCollectorPass()); + $container->addCompilerPass(new DataCollectorPass()); } } From 41dc635d5763ac3fa8e1bf9bd8c5d2ebb221882e Mon Sep 17 00:00:00 2001 From: Oskar Stark Date: Tue, 4 Mar 2025 21:56:24 +0100 Subject: [PATCH 07/11] Add PHP 8.4 to test matrix (#22) --- .github/workflows/ci.yaml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index adb39a3..10fdd38 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -45,6 +45,7 @@ jobs: - '8.1' - '8.2' - '8.3' + - '8.4' dependencies: - 'highest' - 'lowest' From 5beff1726cfd5b72769121e31754aaa088a02def Mon Sep 17 00:00:00 2001 From: Oskar Stark Date: Tue, 4 Mar 2025 21:58:36 +0100 Subject: [PATCH 08/11] Use `getDatabase` and `getCollection` (#19) selectDatabase and selectCollection are deprecated since 1.21 Follows https://github.com/mongodb/mongo-php-library/releases/tag/1.21.0 --- README.md | 6 +++--- src/Attribute/AutowireCollection.php | 2 +- src/Attribute/AutowireDatabase.php | 2 +- .../Functional/DataCollector/DriverEventSubscriberTest.php | 2 +- tests/Functional/FunctionalTestCase.php | 6 +++--- .../src/Controller/AbstractMongoDBController.php | 6 +++--- tests/Unit/Attribute/AutowireCollectionTest.php | 6 +++--- tests/Unit/Attribute/AutowireDatabaseTest.php | 6 +++--- 8 files changed, 18 insertions(+), 18 deletions(-) diff --git a/README.md b/README.md index 2cf4295..d451ecc 100644 --- a/README.md +++ b/README.md @@ -131,7 +131,7 @@ class MyService ## Database Usage The client service provides access to databases and collections. You can access a database by calling the -`selectDatabase` method, passing the database name and potential options: +`getDatabase` method, passing the database name and potential options: ```php use MongoDB\Client; @@ -144,7 +144,7 @@ class MyService public function __construct( Client $client, ) { - $this->database = $client->selectDatabase('myDatabase'); + $this->database = $client->getDatabase('myDatabase'); } } ``` @@ -185,7 +185,7 @@ class MyService ## Collection Usage -To inject a collection, you can either call the `selectCollection` method on a `Client` or `Database` instance. +To inject a collection, you can either call the `getCollection` method on a `Client` or `Database` instance. For convenience, the `#[AutowireCollection]` attribute provides a quicker alternative: ```php diff --git a/src/Attribute/AutowireCollection.php b/src/Attribute/AutowireCollection.php index 6f99bb4..a442bd7 100644 --- a/src/Attribute/AutowireCollection.php +++ b/src/Attribute/AutowireCollection.php @@ -61,7 +61,7 @@ public function __construct( : MongoDBExtension::createClientServiceId($client); parent::__construct( - callable: [new Reference($this->serviceId), 'selectCollection'], + callable: [new Reference($this->serviceId), 'getCollection'], lazy: $lazy, ); } diff --git a/src/Attribute/AutowireDatabase.php b/src/Attribute/AutowireDatabase.php index 0b9b56b..422102c 100644 --- a/src/Attribute/AutowireDatabase.php +++ b/src/Attribute/AutowireDatabase.php @@ -59,7 +59,7 @@ public function __construct( : MongoDBExtension::createClientServiceId($client); parent::__construct( - callable: [new Reference($this->serviceId), 'selectDatabase'], + callable: [new Reference($this->serviceId), 'getDatabase'], lazy: $lazy, ); } diff --git a/tests/Functional/DataCollector/DriverEventSubscriberTest.php b/tests/Functional/DataCollector/DriverEventSubscriberTest.php index 03e31ff..b729e89 100644 --- a/tests/Functional/DataCollector/DriverEventSubscriberTest.php +++ b/tests/Functional/DataCollector/DriverEventSubscriberTest.php @@ -36,7 +36,7 @@ public function collectCommandEvent(int $clientId, string $requestId, array $dat public function testCommandSucceeded(): void { - $this->getClient()->selectCollection('database1', 'collection1')->find(); + $this->getClient()->getCollection('database1', 'collection1')->find(); // The 2 events are commandStarted and commandSucceeded $this->assertCount(2, $this->collector->events); diff --git a/tests/Functional/FunctionalTestCase.php b/tests/Functional/FunctionalTestCase.php index 016abbf..598468a 100644 --- a/tests/Functional/FunctionalTestCase.php +++ b/tests/Functional/FunctionalTestCase.php @@ -68,9 +68,9 @@ public function assertNumberOfDocuments(int $expected, string $clientId, string { $client = self::getContainer()->get(MongoDBExtension::createClientServiceId($clientId)); assert($client instanceof Client); - $db = $client->selectDatabase($database); + $db = $client->getDatabase($database); assert($db instanceof Database); - $collection = $db->selectCollection($collection); + $collection = $db->getCollection($collection); assert($collection instanceof Collection); $this->assertSame($expected, $collection->countDocuments()); @@ -80,7 +80,7 @@ private function dropDatabase(string $clientId, string $database): void { $client = self::getContainer()->get(MongoDBExtension::createClientServiceId($clientId)); assert($client instanceof Client); - $db = $client->selectDatabase($database); + $db = $client->getDatabase($database); assert($db instanceof Database); $db->drop(); } diff --git a/tests/TestApplication/src/Controller/AbstractMongoDBController.php b/tests/TestApplication/src/Controller/AbstractMongoDBController.php index 990ac84..5426fb9 100644 --- a/tests/TestApplication/src/Controller/AbstractMongoDBController.php +++ b/tests/TestApplication/src/Controller/AbstractMongoDBController.php @@ -67,11 +67,11 @@ final public function insertDocumentForClient(Client|string $client, ?string $da assert($database !== null); - $db = $client->selectDatabase($database); + $db = $client->getDatabase($database); $db->drop(); if (! $collection instanceof Collection) { - $collection = $db->selectCollection($collection); + $collection = $db->getCollection($collection); } $collection->insertOne(['foo' => 'bar']); @@ -80,7 +80,7 @@ final public function insertDocumentForClient(Client|string $client, ?string $da final public function insertDocumentForDatabase(Database $database, string $collection): void { $database->drop(); - $collection = $database->selectCollection($collection); + $collection = $database->getCollection($collection); $collection->insertOne(['foo' => 'bar']); } diff --git a/tests/Unit/Attribute/AutowireCollectionTest.php b/tests/Unit/Attribute/AutowireCollectionTest.php index 006a73d..4a79d1b 100644 --- a/tests/Unit/Attribute/AutowireCollectionTest.php +++ b/tests/Unit/Attribute/AutowireCollectionTest.php @@ -35,7 +35,7 @@ public function testMinimal(): void { $autowire = new AutowireCollection(); - $this->assertEquals([new Reference($client = Client::class), 'selectCollection'], $autowire->value); + $this->assertEquals([new Reference($client = Client::class), 'getCollection'], $autowire->value); $definition = $autowire->buildDefinition( value: $autowire->value, @@ -62,7 +62,7 @@ public function testCollection(): void client: 'default', ); - $this->assertEquals([new Reference('mongodb.client.default'), 'selectCollection'], $autowire->value); + $this->assertEquals([new Reference('mongodb.client.default'), 'getCollection'], $autowire->value); $definition = $autowire->buildDefinition( value: $autowire->value, @@ -88,7 +88,7 @@ public function testWithoutCollection(): void client: 'default', ); - $this->assertEquals([new Reference('mongodb.client.default'), 'selectCollection'], $autowire->value); + $this->assertEquals([new Reference('mongodb.client.default'), 'getCollection'], $autowire->value); $definition = $autowire->buildDefinition( value: $autowire->value, diff --git a/tests/Unit/Attribute/AutowireDatabaseTest.php b/tests/Unit/Attribute/AutowireDatabaseTest.php index 1958e20..d6bc805 100644 --- a/tests/Unit/Attribute/AutowireDatabaseTest.php +++ b/tests/Unit/Attribute/AutowireDatabaseTest.php @@ -34,7 +34,7 @@ public function testMinimal(): void { $autowire = new AutowireDatabase(); - $this->assertEquals([new Reference(Client::class), 'selectDatabase'], $autowire->value); + $this->assertEquals([new Reference(Client::class), 'getDatabase'], $autowire->value); $definition = $autowire->buildDefinition( value: $autowire->value, @@ -58,7 +58,7 @@ public function testDatabase(): void client: 'default', ); - $this->assertEquals([new Reference('mongodb.client.default'), 'selectDatabase'], $autowire->value); + $this->assertEquals([new Reference('mongodb.client.default'), 'getDatabase'], $autowire->value); $definition = $autowire->buildDefinition( value: $autowire->value, @@ -82,7 +82,7 @@ public function testWithoutDatabase(): void client: 'default', ); - $this->assertEquals([new Reference('mongodb.client.default'), 'selectDatabase'], $autowire->value); + $this->assertEquals([new Reference('mongodb.client.default'), 'getDatabase'], $autowire->value); $definition = $autowire->buildDefinition( value: $autowire->value, From 1cbc4c562c02057aaa3b40e9cfd146dca4f3250c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9r=C3=B4me=20Tamarelle?= Date: Wed, 5 Mar 2025 08:22:00 +0100 Subject: [PATCH 09/11] Allow usage of `#[Target]` attribute for the MongoDB client (#15) * Allow usage of #[Target] attribute for the MongoDB client * Add test to autowire client using #[Target] attribute --- README.md | 15 +++++++++++++++ src/DependencyInjection/MongoDBExtension.php | 1 + tests/Functional/Attribute/AutowireClientTest.php | 3 +++ .../src/Controller/AutowireClientController.php | 11 +++++++++++ 4 files changed, 30 insertions(+) diff --git a/README.md b/README.md index d451ecc..71fbdd7 100644 --- a/README.md +++ b/README.md @@ -128,6 +128,21 @@ class MyService } ``` +You can also use the `#[Target]` attribute: + +```php +use MongoDB\Client; +use Symfony\Component\DependencyInjection\Attribute\Target; + +class MyService +{ + public function __construct( + #[Target('second')] + private Client $client, + ) {} +} +``` + ## Database Usage The client service provides access to databases and collections. You can access a database by calling the diff --git a/src/DependencyInjection/MongoDBExtension.php b/src/DependencyInjection/MongoDBExtension.php index 3b4ce85..ff23ce3 100644 --- a/src/DependencyInjection/MongoDBExtension.php +++ b/src/DependencyInjection/MongoDBExtension.php @@ -78,6 +78,7 @@ private function createClients(string $defaultClient, array $clients, ContainerB // Allows to autowire the client using the name $container->registerAliasForArgument($serviceId, Client::class, sprintf('%sClient', $client)); + $container->registerAliasForArgument($serviceId, Client::class, $client); } // Register an autowiring alias for the default client diff --git a/tests/Functional/Attribute/AutowireClientTest.php b/tests/Functional/Attribute/AutowireClientTest.php index cd2ce86..7fc6b9c 100644 --- a/tests/Functional/Attribute/AutowireClientTest.php +++ b/tests/Functional/Attribute/AutowireClientTest.php @@ -53,6 +53,9 @@ public static function autowireClientProvider(): iterable /** @see AutowireClientController::viaNamedClient() */ yield 'via-named-client' => ['/autowire-client/via-named-client', self::CLIENT_ID_SECONDARY, self::DB_CUSTOMER_GOOGLE, self::COLLECTION_USERS]; + + /** @see AutowireClientController::viaTarget() */ + yield 'via-target' => ['/autowire-client/via-target', self::CLIENT_ID_SECONDARY, self::DB_CUSTOMER_GOOGLE, self::COLLECTION_USERS]; } /** diff --git a/tests/TestApplication/src/Controller/AutowireClientController.php b/tests/TestApplication/src/Controller/AutowireClientController.php index 820c45b..ef88184 100644 --- a/tests/TestApplication/src/Controller/AutowireClientController.php +++ b/tests/TestApplication/src/Controller/AutowireClientController.php @@ -24,6 +24,7 @@ use MongoDB\Bundle\Tests\Functional\Attribute\AutowireClientTest; use MongoDB\Bundle\Tests\Functional\FunctionalTestCase; use MongoDB\Client; +use Symfony\Component\DependencyInjection\Attribute\Target; use Symfony\Component\HttpFoundation\JsonResponse; use Symfony\Component\Routing\Annotation\Route; @@ -69,6 +70,16 @@ public function viaNamedClient( return new JsonResponse(); } + #[Route('/via-target')] + public function viaTarget( + #[Target('secondary')] + Client $client, + ): JsonResponse { + $this->insertDocumentForClient($client, FunctionalTestCase::DB_CUSTOMER_GOOGLE, FunctionalTestCase::COLLECTION_USERS); + + return new JsonResponse(); + } + #[Route('/with-unknown-client')] public function withUnknownClient( #[AutowireClient(client: 'foo-bar-baz')] From 7797702b63631656dd639366cdfc76210e4e84d1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9r=C3=B4me=20Tamarelle?= Date: Wed, 5 Mar 2025 08:41:46 +0100 Subject: [PATCH 10/11] Fix CS --- src/Attribute/AutowireCollection.php | 1 - tests/Functional/DataCollector/DriverEventSubscriberTest.php | 2 +- tests/Unit/Attribute/AttributeTestCase.php | 2 ++ 3 files changed, 3 insertions(+), 2 deletions(-) diff --git a/src/Attribute/AutowireCollection.php b/src/Attribute/AutowireCollection.php index a442bd7..5627157 100644 --- a/src/Attribute/AutowireCollection.php +++ b/src/Attribute/AutowireCollection.php @@ -34,7 +34,6 @@ use Symfony\Component\DependencyInjection\Reference; use function is_string; -use function ltrim; use function sprintf; /** diff --git a/tests/Functional/DataCollector/DriverEventSubscriberTest.php b/tests/Functional/DataCollector/DriverEventSubscriberTest.php index b729e89..2f9a2ce 100644 --- a/tests/Functional/DataCollector/DriverEventSubscriberTest.php +++ b/tests/Functional/DataCollector/DriverEventSubscriberTest.php @@ -31,7 +31,7 @@ public function collectCommandEvent(int $clientId, string $requestId, array $dat } }; - $this->stopwatch = new Stopwatch();; + $this->stopwatch = new Stopwatch(); } public function testCommandSucceeded(): void diff --git a/tests/Unit/Attribute/AttributeTestCase.php b/tests/Unit/Attribute/AttributeTestCase.php index e7ee39e..0a9ec3a 100644 --- a/tests/Unit/Attribute/AttributeTestCase.php +++ b/tests/Unit/Attribute/AttributeTestCase.php @@ -1,5 +1,7 @@ Date: Fri, 21 Mar 2025 10:12:09 +0100 Subject: [PATCH 11/11] Support MongoDB Driver 2.0 (#24) * Support version 2.0 of the MongoDB driver * Test with driver version 2.x in CI --- .github/workflows/ci.yaml | 11 ++++++++++- composer.json | 4 ++-- 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 10fdd38..4756bda 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -12,7 +12,7 @@ permissions: jobs: test: - name: PHP ${{ matrix.php-version }} + ${{ matrix.dependencies }} + ${{ matrix.variant }} + name: PHP ${{ matrix.php-version }} + ${{ matrix.driver-version }} + ${{ matrix.dependencies }} + ${{ matrix.variant }} runs-on: ubuntu-latest @@ -46,6 +46,8 @@ jobs: - '8.2' - '8.3' - '8.4' + driver-version: + - 'stable' dependencies: - 'highest' - 'lowest' @@ -56,6 +58,12 @@ jobs: - 'symfony/symfony:"6.3.*"' - 'symfony/symfony:"6.4.*"' - 'symfony/symfony:"7.0.*"' + include: + - php-version: '8.4' + driver-version: 'mongodb/mongo-php-driver@v2.x' + dependencies: 'highest' + symfony-require: '' + variant: 'normal' steps: - name: Checkout @@ -65,6 +73,7 @@ jobs: uses: shivammathur/setup-php@v2 with: php-version: ${{ matrix.php-version }} + extensions: "mongodb-${{ matrix.driver-version }}" - name: Add PHPUnit matcher run: echo "::add-matcher::${{ runner.tool_cache }}/phpunit.json" diff --git a/composer.json b/composer.json index cba6e6b..a5a803e 100644 --- a/composer.json +++ b/composer.json @@ -13,8 +13,8 @@ ], "require": { "php": ">=8.1", - "ext-mongodb": "^1.21", - "mongodb/mongodb": "^1.21", + "ext-mongodb": "^1.21 || ^2.0@dev", + "mongodb/mongodb": "^1.21 || ^2.0@dev", "symfony/config": "^6.3 || ^7.0", "symfony/console": "^6.3 || ^7.0", "symfony/dependency-injection": "^6.3.5 || ^7.0",