Skip to content

Commit 13bddeb

Browse files
author
Joe Bennett
committed
#27345 added new constructor support and options
1 parent 480c198 commit 13bddeb

File tree

1 file changed

+18
-11
lines changed

1 file changed

+18
-11
lines changed

components/lock.rst

Lines changed: 18 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -287,9 +287,11 @@ MongoDbStore
287287

288288
The ``MongoDbStore`` was introduced in Symfony 4.4.
289289

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::
293295

294296
use MongoDB\Client;
295297
use Symfony\Component\Lock\Store\MongoDbStore;
@@ -298,19 +300,22 @@ support blocking and expects a TTL to avoid stalled locks::
298300

299301
$options = [
300302
'database' => 'my-app',
303+
'collection' => 'lock',
301304
];
302305

303306
$store = new MongoDbStore($client, $options);
304307

305-
The ``MongoDbStore`` takes the following options:
308+
The ``MongoDbStore`` takes the following options (depending on the first parameter type):
306309

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+
============= ================================= ========= ========================================================================
314319

315320
.. _lock-store-pdo:
316321

@@ -755,7 +760,9 @@ are still running.
755760
.. _`Doctrine DBAL Connection`: https://github.com/doctrine/dbal/blob/master/lib/Doctrine/DBAL/Connection.php
756761
.. _`Expire Data from Collections by Setting TTL`: https://docs.mongodb.com/manual/tutorial/expire-data/
757762
.. _`locks`: https://en.wikipedia.org/wiki/Lock_(computer_science)
763+
.. _`MongoDB Connection String`: https://docs.mongodb.com/manual/reference/connection-string/
758764
.. _`mongodb/mongodb`: https://packagist.org/packages/mongodb/mongodb
765+
.. _`MongoDBClient::__construct`: https://docs.mongodb.com/php-library/current/reference/method/MongoDBClient__construct/
759766
.. _`PDO`: https://php.net/pdo
760767
.. _`PHP semaphore functions`: https://php.net/manual/en/book.sem.php
761768
.. _`Replica Set Read and Write Semantics`: https://docs.mongodb.com/manual/applications/replication/

0 commit comments

Comments
 (0)