@@ -239,16 +239,13 @@ This store does not support blocking, and expects a TTL to avoid stalled locks::
239
239
240
240
The ``MongoDbStore `` takes the following ``$options ``:
241
241
242
- =============== =============== ===================================================================================
243
- Option Default Description
244
- =============== =============== ===================================================================================
245
- database The name of the database [Mandatory]
246
- collection ``lock `` The name of the collection
247
- resource_field ``_id `` The field name for storing the lock id **MUST be uniquely indexed if you chage it **
248
- token_field ``token `` The field name for storing the lock token
249
- acquired_field ``acquired_at `` The field name for storing the acquisition timestamp
250
- expiry_field ``expires_at `` The field name for storing the expiry-timestamp
251
- =============== =============== ===================================================================================
242
+ ========== ========= =============================================================
243
+ Option Default Description
244
+ ========== ========= =============================================================
245
+ database The name of the database [Mandatory]
246
+ collection ``lock `` The name of the collection
247
+ initialTtl ``300.0 `` The expiration delay of locks in seconds
248
+ ========== ========= =============================================================
252
249
253
250
.. _lock-store-redis :
254
251
@@ -469,23 +466,35 @@ method uses the Memcached's ``flush()`` method which purges and removes everythi
469
466
MongoDbStore
470
467
~~~~~~~~~~~~
471
468
472
- The MongoDbStore relies on a unique index on the ``<resource_field> ``. By default
473
- this is ``_id `` which already has a unique index being the collection identifier.
474
- It is strongly recommended to leave this as is. If you do need to change the
475
- ``<resource_field> `` you **MUST ** ensure you place a unique index on your filed.
469
+ An indexed field's value in MongoDB can be a maximum of 1024 bytes in length
470
+ inclusive of structural overhead.
471
+
472
+ For more details see: https://docs.mongodb.com/manual/reference/limits/#Index-Key-Limit
473
+
474
+ .. caution ::
475
+
476
+ This store relies on all client and server nodes to have
477
+ synchronized clocks for lock expiry to occur at the correct time.
478
+ To ensure locks don't expire prematurely; the ttl's should be set with enough
479
+ extra time to account for any clock drift between nodes.
480
+
481
+ A TTL index MUST BE used on MongoDB 2.2+ to automatically clean up expired locks.
476
482
477
- A TTL index can be used on MongoDB 2.2+ to cleanup expired locks automatically.
478
483
Such an index can for example look like this:
479
484
480
485
.. code-block :: javascript
481
486
482
- db.< lock- collection > .ensureIndex (
483
- { " <expiry-field> " : 1 },
487
+ db .lock .ensureIndex (
488
+ { " expires_at " : 1 },
484
489
{ " expireAfterSeconds" : 0 }
485
490
)
486
491
487
492
For more details see: http://docs.mongodb.org/manual/tutorial/expire-data/
488
493
494
+ writeConcern, readConcern and readPreference are not specified by MongoDbStore
495
+ meaning the collection's settings will take effect.
496
+ For more details see: https://docs.mongodb.com/manual/applications/replication/
497
+
489
498
RedisStore
490
499
~~~~~~~~~~
491
500
0 commit comments