A Node.js library for MongoDB-backed leader election, inspired by redis-leader. Current stable version is 1.6.7, with regular releases. It extends EventEmitter to emit 'elected' and 'revoked' events when leadership status changes. Key differentiators: automatic TTL index handling (since 1.5.0) avoids IndexOptionsConflict on config changes; supports lazy start and polling; minimal dependencies. Compared to alternatives like node-zookeeper-leader or redis-leader, it leverages MongoDB's existing infrastructure.
No compatibility data collected yet for this library.
Verified import paths — ran on the pinned version, not inferred.
ESM-only. The package does not support CommonJS require.
TypeScript type export for configuring Leader constructor options.
Enum of event names ('elected' | 'revoked'). Must use the exported LeaderEvent symbol.
Shows basic setup: connect to MongoDB, create Leader instance with TTL/wait options, listen for events, start leader election, poll status, and graceful shutdown.
Breaking-change detection hasn't run for this library yet.
CVE tracking and dependency tree are planned for a later release.