@@ -287,9 +287,11 @@ MongoDbStore
287
287
288
288
The ``MongoDbStore `` was introduced in Symfony 4.4.
289
289
290
- The MongoDbStore saves locks on a MongoDB server ``^2.2 ``, it requires a
291
- ``\MongoDB\Client `` connection from `mongodb/mongodb `_. This store does not
292
- support blocking and expects a TTL to avoid stalled locks::
290
+ The MongoDbStore saves locks on a MongoDB server ``>=2.2 ``, it requires a
291
+ ``\MongoDB\Collection `` or ``\MongoDB\Client `` from `mongodb/mongodb `_ or a
292
+ `MongoDB Connection String `_.
293
+ This store does not support blocking and expects a TTL to
294
+ avoid stalled locks::
293
295
294
296
use MongoDB\Client;
295
297
use Symfony\Component\Lock\Store\MongoDbStore;
@@ -298,19 +300,22 @@ support blocking and expects a TTL to avoid stalled locks::
298
300
299
301
$options = [
300
302
'database' => 'my-app',
303
+ 'collection' => 'lock',
301
304
];
302
305
303
306
$store = new MongoDbStore($client, $options);
304
307
305
- The ``MongoDbStore `` takes the following options:
308
+ The ``MongoDbStore `` takes the following options (depending on the first parameter type) :
306
309
307
- ============ ========= ========================================================================
308
- Option Default Description
309
- ============ ========= ========================================================================
310
- database The name of the database [Mandatory]
311
- collection ``lock `` The name of the collection
312
- gcProbablity ``0.001 `` Should a TTL Index be created expressed as a probability from 0.0 to 1.0
313
- ============ ========= ========================================================================
310
+ ============= ================================= ========= ========================================================================
311
+ Option First Parameter Type Default Description
312
+ ============= ================================= ========= ========================================================================
313
+ gcProbablity any ``0.001 `` Should a TTL Index be created expressed as a probability from 0.0 to 1.0
314
+ database ``\MongoDB\Client `` or ``string `` The name of the database [Mandatory]
315
+ collection ``\MongoDB\Client `` or ``string `` ``lock `` The name of the collection
316
+ uriOptions ``string `` ``[] `` Array of uri options for `MongoDBClient::__construct `_
317
+ driverOptions ``string `` ``[] `` Array of driver options for `MongoDBClient::__construct `_
318
+ ============= ================================= ========= ========================================================================
314
319
315
320
.. _lock-store-pdo :
316
321
@@ -755,7 +760,9 @@ are still running.
755
760
.. _`Doctrine DBAL Connection` : https://github.com/doctrine/dbal/blob/master/lib/Doctrine/DBAL/Connection.php
756
761
.. _`Expire Data from Collections by Setting TTL` : https://docs.mongodb.com/manual/tutorial/expire-data/
757
762
.. _`locks` : https://en.wikipedia.org/wiki/Lock_(computer_science)
763
+ .. _`MongoDB Connection String` : https://docs.mongodb.com/manual/reference/connection-string/
758
764
.. _`mongodb/mongodb` : https://packagist.org/packages/mongodb/mongodb
765
+ .. _`MongoDBClient::__construct` : https://docs.mongodb.com/php-library/current/reference/method/MongoDBClient__construct/
759
766
.. _`PDO` : https://php.net/pdo
760
767
.. _`PHP semaphore functions` : https://php.net/manual/en/book.sem.php
761
768
.. _`Replica Set Read and Write Semantics` : https://docs.mongodb.com/manual/applications/replication/
0 commit comments