{"id":44944,"library":"fh-mongodb-queue","title":"fh-mongodb-queue","description":"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.","status":"abandoned","version":"3.3.0","language":"javascript","source_language":"en","source_url":"git://github.com/feedhenry/fh-mongodb-queue","tags":["javascript","mongodb","queue"],"install":[{"cmd":"npm install fh-mongodb-queue","lang":"bash","label":"npm"},{"cmd":"yarn add fh-mongodb-queue","lang":"bash","label":"yarn"},{"cmd":"pnpm add fh-mongodb-queue","lang":"bash","label":"pnpm"}],"dependencies":[{"reason":"Requires MongoDB driver (2.x or 3.x) for database connection. Not bundled.","package":"mongodb","optional":false}],"imports":[{"note":"Package is CommonJS only. No default ESM export; using ESM import will fail or require special handling.","wrong":"import mongoDbQueue from 'fh-mongodb-queue';","symbol":"default","correct":"const mongoDbQueue = require('fh-mongodb-queue');"},{"note":"This is from the mongodb driver, not from fh-mongodb-queue itself.","wrong":"const MongoClient = require('mongodb').MongoClient;","symbol":"MongoClient","correct":"const { MongoClient } = require('mongodb');"},{"note":"Factory function returns a queue instance. Chaining is possible but not recommended for readability.","wrong":"mongoDbQueue(db, 'my-queue').add(...);","symbol":"queue methods (add, get, ack, etc.)","correct":"const queue = mongoDbQueue(db, 'my-queue'); queue.add(...);"}],"quickstart":{"code":"const MongoClient = require('mongodb').MongoClient;\nconst mongoDbQueue = require('fh-mongodb-queue');\n\nconst con = 'mongodb://localhost:27017/test';\nMongoClient.connect(con, { useNewUrlParser: true, useUnifiedTopology: true }, (err, client) => {\n  if (err) return console.error(err);\n  const db = client.db();\n  const queue = mongoDbQueue(db, 'my-queue');\n  queue.createIndexes((err) => {\n    if (err) return console.error(err);\n    queue.add('Hello, World!', (err, id) => {\n      if (err) return console.error(err);\n      console.log('Added message id:', id);\n      queue.get({ visibility: 30 }, (err, msg) => {\n        if (err) return console.error(err);\n        console.log('Got message:', msg.payload);\n        queue.ack(msg.ack, (err) => {\n          if (err) return console.error(err);\n          client.close();\n        });\n      });\n    });\n  });\n});","lang":"javascript","description":"Connects to MongoDB, creates a queue, adds and retrieves a message, and acks it. Includes index creation."},"warnings":[{"fix":"Migrate to maintained alternatives like @neurocode/mongodb-queue or bull with MongoDB.","message":"Package is abandoned; last updated in 2017. No bug fixes or security patches. Use at your own risk.","severity":"breaking","affected_versions":">=0.0.0"},{"fix":"Use mongodb@3.7.4 or downgrade to 2.x. For mongodb@4, manually promisify or use a wrapper.","message":"Relies on MongoDB driver 2.x or 3.x callback API. Modern MongoDB driver 4.x+ uses promises and connection pooling may break this package.","severity":"breaking","affected_versions":">=3.0.0"},{"fix":"Wrap in util.promisify or promisify-all to use async/await.","message":"Callbacks are the only async pattern supported. No promise or async/await support. Error-first callbacks only.","severity":"deprecated","affected_versions":">=0.0.0"},{"fix":"Call queue.createIndexes() once before using the queue.","message":"Index creation (createIndexes) must be called explicitly; it is not automatic. Missing indexes can lead to poor performance.","severity":"gotcha","affected_versions":">=0.0.0"},{"fix":"Periodically call queue.clean() to remove processed messages.","message":"Messages are never automatically deleted; acked messages remain in the collection unless queue.clean() is called.","severity":"gotcha","affected_versions":">=0.0.0"},{"fix":"Use valid MongoDB collection names, e.g., alphanumeric with underscores.","message":"The queue name directly corresponds to a MongoDB collection name; ensure the name meets MongoDB collection naming rules (e.g., no empty string).","severity":"gotcha","affected_versions":">=0.0.0"}],"env_vars":null,"search_vec":"'2017':23 '3.3.0':20 'ack':30 'add':28 'alreadi':43 'altern':49 'app':42 'back':59 'basic':25 'batch':71 'built':9 'clean':32 'configur':34 'dead':66 'dead-lett':65 'dedic':51 'delay':38 'design':39 'driver':74 'fh':2 'fh-mongodb-queu':1 'fork':14 'get':29 'javascript':78 'letter':67 'lightweight':6 'like':54 'messag':7,70 'mongodb':3,13,17,45,73,79 'mongodb-queu':16 'node.js':41 'offer':46 'oper':27 'ping':31 'provid':24 'queue':4,8,18,26,52,60,68,80 'rabbitmq':55 'redi':58 'redis-back':57 'requir':72 'simpl':48 'sinc':22 'support':62 'system':53 'top':11 'ttl':64 'unmaintain':21 'use':44 'v2.x':75 'v3.x':77 'version':19 'visibl':35 'window':36","created_at":"2026-06-07T12:52:36.852550+00:00","updated_at":"2026-06-07T12:52:36.852550+00:00","problems":[{"fix":"Ensure you call queue.createIndexes() before using the queue, or the queue collection will be created lazily.","cause":"Queue collection does not exist or not yet created.","error":"MongoError: ns not found"},{"fix":"Check if msg is null before accessing properties.","cause":"queue.get() returned null when no messages are available, but code assumed an object.","error":"TypeError: Cannot read property 'payload' of null"},{"fix":"Use: const queue = mongoDbQueue(db, 'my-queue'); then queue.add(...).","cause":"Incorrect import or usage; the factory function was not called correctly, or the wrong package was imported.","error":"TypeError: queue.add is not a function"},{"fix":"Upgrade MongoDB to 3.2+ or manually create indexes without partialFilterExpression.","cause":"Old or incompatible MongoDB version (pre-3.2) does not support partialFilterExpression which is used by createIndexes.","error":"MongoError: cannot add unique index with partialFilterExpression"}],"ecosystem":"npm","meta_description":null,"install_score":null,"quickstart_score":null,"quickstart_tag":null,"pypi_latest":null,"cli_name":null,"cli_version":null,"type":"library","homepage":"https://github.com/feedhenry/fh-mongodb-queue","github":"git://github.com/feedhenry/fh-mongodb-queue","docs":null,"changelog":null,"pypi":null,"npm":"fh-mongodb-queue","openapi_spec":null,"status_page":null,"smithery":null,"categories":["database"],"base_url":null,"auth_type":null,"provenance":{"verified_status":null,"verified_at":null,"last_verified":"2026-06-07","next_check":"2026-09-05","install_tag":null}}