{"id":42482,"library":"cache-manager-mongodb","title":"cache-manager-mongodb","description":"MongoDB store for node-cache-manager (v0.3.0). This package integrates MongoDB as a persistent caching backend for the node-cache-manager module. It provides a simple API for get, set, del, and wrap operations with full Promise support. The store supports configurable collection names, compression, pool size, and auto-reconnect. Unlike in-memory or Redis stores, it leverages MongoDB for durable, shared caching across multiple processes or servers. The package has low release activity and is considered stable but not actively developed.","status":"maintenance","version":"0.3.0","language":"javascript","source_language":"en","source_url":"https://github.com/v4l3r10/node-cache-manager-mongodb","tags":["javascript","cache","mongodb","cache manager","multiple cache"],"install":[{"cmd":"npm install cache-manager-mongodb","lang":"bash","label":"npm"},{"cmd":"yarn add cache-manager-mongodb","lang":"bash","label":"yarn"},{"cmd":"pnpm add cache-manager-mongodb","lang":"bash","label":"pnpm"}],"dependencies":[{"reason":"Peer dependency; this package provides a MongoDB store for the cache manager infrastructure.","package":"node-cache-manager","optional":false},{"reason":"Required to interact with MongoDB; typically the 'mongodb' driver is a dependency of this package.","package":"mongodb","optional":false}],"imports":[{"note":"This package is CommonJS-only and does not provide ESM exports.","wrong":"import mongoStore from 'cache-manager-mongodb'","symbol":"default","correct":"const mongoStore = require('cache-manager-mongodb')"},{"note":"You must use node-cache-manager's caching() function with the store option, not call mongoStore directly.","wrong":"const mongoStore = require('cache-manager-mongodb'); const cache = mongoStore()","symbol":"cacheManager","correct":"const cacheManager = require('cache-manager')"},{"note":"There is no named export; the whole module is the store object.","wrong":"const { MongoStore } = require('cache-manager-mongodb')","symbol":"MongoStore","correct":"const mongoStore = require('cache-manager-mongodb')"}],"quickstart":{"code":"const cacheManager = require('cache-manager');\nconst mongoStore = require('cache-manager-mongodb');\n\nconst mongoCache = cacheManager.caching({\n  store: mongoStore,\n  uri: process.env.MONGO_URI || 'mongodb://localhost:27017/cacheDb',\n  options: {\n    collection: 'cacheManager',\n    compression: false,\n    poolSize: 5,\n    autoReconnect: true\n  },\n  ttl: 60\n});\n\nmongoCache.set('myKey', 'myValue', 60)\n  .then(() => mongoCache.get('myKey'))\n  .then(result => {\n    console.log(result); // 'myValue'\n    return mongoCache.del('myKey');\n  })\n  .catch(err => console.error(err));","lang":"javascript","description":"Shows how to create a MongoDB-backed cache store, set, get, and delete a value using Promises."},"warnings":[{"fix":"Replace callbacks with .then()/.catch() or use async/await.","message":"Version 0.2.0 switched from callbacks to full Promise support; old callback-style code will break.","severity":"breaking","affected_versions":">=0.2.0"},{"fix":"Install @types/cache-manager-mongodb if available, or declare module manually.","message":"The package has no TypeScript types; using it in a TypeScript project may require custom type declarations.","severity":"gotcha","affected_versions":"*"},{"fix":"Ensure URI contains username:password@host:port/dbname.","message":"MongoDB connection URI must include credentials if authentication is enabled; otherwise connection fails silently.","severity":"gotcha","affected_versions":"*"},{"fix":"Consider alternatives like cache-manager-ioredis or cache-manager-mongoose.","message":"The package is not actively maintained; no updates since 2019. It may not work with newer MongoDB drivers or node-cache-manager versions.","severity":"deprecated","affected_versions":">=0.3.0"}],"env_vars":null,"search_vec":"'across':72 'activ':82,89 'api':33 'auto':56 'auto-reconnect':55 'backend':21 'cach':2,10,20,26,71,92,94,97 'cache-manager-mongodb':1 'collect':49 'compress':51 'configur':48 'consid':85 'del':37 'develop':90 'durabl':69 'full':42 'get':35 'in-memori':59 'integr':15 'javascript':91 'leverag':66 'low':80 'manag':3,11,27,95 'memori':61 'modul':28 'mongodb':4,5,16,67,93 'multipl':73,96 'name':50 'node':9,25 'node-cache-manag':8,24 'oper':40 'packag':14,78 'persist':19 'pool':52 'process':74 'promis':43 'provid':30 'reconnect':57 'redi':63 'releas':81 'server':76 'set':36 'share':70 'simpl':32 'size':53 'stabl':86 'store':6,46,64 'support':44,47 'unlik':58 'v0.3.0':12 'wrap':39","created_at":"2026-06-05T16:55:12.208716+00:00","updated_at":"2026-06-05T16:55:12.208716+00:00","problems":[{"fix":"Provide options.collection as a string: { collection: 'myCache' }","cause":"Passing an invalid options object without 'collection' property or wrong type.","error":"Error: The collection parameter must be a string, or an object with a collection property"},{"fix":"Use cacheManager.caching({ store: mongoStore, ... })","cause":"Attempting to use mongoStore() directly instead of passing it as a store option to cacheManager.caching()","error":"TypeError: mongoStore is not a constructor"}],"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/v4l3r10/node-cache-manager-mongodb#readme","github":"https://github.com/v4l3r10/node-cache-manager-mongodb","docs":null,"changelog":null,"pypi":null,"npm":"cache-manager-mongodb","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-05","next_check":"2026-09-03","install_tag":null}}