mongo-dlock
JSON →Distributed lock implementation based on MongoDB for Node.js, version 2.0.4. It supports one-shot lock attempts and automatic retry via polling, lock refresh (including auto-refresh), and data payloads attached to locks. Uses MongoDB TTL indexes to clean up stray locks. The 2.0.0 major release removed pubsub-based event propagation via a capped collection and EventEmitter, simplifying the internals to rely solely on polling. Compared to alternatives like Redis-based locks, mongo-dlock leverages existing MongoDB infrastructure without additional services. It defaults to a 15-second lock expiration and a 5-second polling interval.