Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit a5c9951

Browse filesBrowse files
author
Joe Bennett
committed
#27345 added new constructor support and options
1 parent dd61ac8 commit a5c9951
Copy full SHA for a5c9951

File tree

Expand file treeCollapse file tree

1 file changed

+18
-11
lines changed
Filter options
Expand file treeCollapse file tree

1 file changed

+18
-11
lines changed

‎components/lock.rst

Copy file name to clipboardExpand all lines: components/lock.rst
+18-11Lines changed: 18 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -276,9 +276,11 @@ MongoDbStore
276276

277277
The ``MongoDbStore`` was introduced in Symfony 4.4.
278278

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

283285
use MongoDB\Client;
284286
use Symfony\Component\Lock\Store\MongoDbStore;
@@ -287,19 +289,22 @@ support blocking and expects a TTL to avoid stalled locks::
287289

288290
$options = [
289291
'database' => 'my-app',
292+
'collection' => 'lock',
290293
];
291294

292295
$store = new MongoDbStore($client, $options);
293296

294-
The ``MongoDbStore`` takes the following options:
297+
The ``MongoDbStore`` takes the following options (depending on the first parameter type):
295298

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

304309
.. _lock-store-pdo:
305310

@@ -744,7 +749,9 @@ are still running.
744749
.. _`Doctrine DBAL Connection`: https://github.com/doctrine/dbal/blob/master/lib/Doctrine/DBAL/Connection.php
745750
.. _`Expire Data from Collections by Setting TTL`: https://docs.mongodb.com/manual/tutorial/expire-data/
746751
.. _`locks`: https://en.wikipedia.org/wiki/Lock_(computer_science)
752+
.. _`MongoDB Connection String`: https://docs.mongodb.com/manual/reference/connection-string/
747753
.. _`mongodb/mongodb`: https://packagist.org/packages/mongodb/mongodb
754+
.. _`MongoDBClient::__construct`: https://docs.mongodb.com/php-library/current/reference/method/MongoDBClient__construct/
748755
.. _`PDO`: https://php.net/pdo
749756
.. _`PHP semaphore functions`: https://php.net/manual/en/book.sem.php
750757
.. _`Replica Set Read and Write Semantics`: https://docs.mongodb.com/manual/applications/replication/

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.