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