A lightweight message queue built on top of MongoDB, forked from mongodb-queue. Version 3.3.0 (unmaintained since 2017). Provides basic queue operations (add, get, ack, ping, clean) with configurable visibility window and delay. Designed for Node.js apps already using MongoDB, offering a simple alternative to dedicated queue systems like RabbitMQ or Redis-backed queues. No support for TTL, dead-letter queues, or message batching. Requires MongoDB driver v2.x or v3.x.
npm install fh-mongodb-queueNo compatibility data collected yet for this library.
Verified import paths — ran on the pinned version, not inferred.
Connects to MongoDB, creates a queue, adds and retrieves a message, and acks it. Includes index creation.
Migrate to maintained alternatives like @neurocode/mongodb-queue or bull with MongoDB.
Use mongodb@3.7.4 or downgrade to 2.x. For mongodb@4, manually promisify or use a wrapper.
Wrap in util.promisify or promisify-all to use async/await.
Call queue.createIndexes() once before using the queue.
Periodically call queue.clean() to remove processed messages.
Use valid MongoDB collection names, e.g., alphanumeric with underscores.
Ensure you call queue.createIndexes() before using the queue, or the queue collection will be created lazily.
Check if msg is null before accessing properties.
Use: const queue = mongoDbQueue(db, 'my-queue'); then queue.add(...).
Upgrade MongoDB to 3.2+ or manually create indexes without partialFilterExpression.