MongoDB persistence layer for the Aedes MQTT broker. Version 9.4.2 requires Node.js >=20. Supports flexible TTL per collection (incoming, outgoing, retained, will, subscriptions) or per-message, and can use either a connection string or an existing MongoDB instance. Integrates with Mongoose via the native db object. The persistence follows the aedes-persistence interface and is intended for production MQTT deployments needing durable session storage. Maintained under the moscajs organization with active CI and coverage.
npm install aedes-persistence-mongodbNo compatibility data collected yet for this library.
Verified import paths — ran on the pinned version, not inferred.
Creates an Aedes MQTT broker with MongoDB persistence, using environment variable for connection URL and setting TTLs.
Update Node.js to version 20 or later.
Set dropExistingIndexes: true when changing ttlAfterDisconnected or TTL durations.
Provide either url or db, not both.
Ensure that aedes-persistence-mongodb is correctly configured with TTL or that clients disconnect cleanly.
Use `import aedesPersistenceMongoDB from 'aedes-persistence-mongodb'`.
Install aedes: `npm install aedes`.