MongoDB storage adapter for Keyv with Mongoose support. v3.0.0 requires mongoose ^6 and mongodb ^4 as peer dependencies. Provides connection reuse for Mongoose connections, native MongoDB driver, or connection strings. Lightweight wrapper for Keyv's key-value cache interface. Regular releases, stable.
npm install keyv-mongodbNo compatibility data collected yet for this library.
Verified import paths — ran on the pinned version, not inferred.
Create a Keyv instance with MongoDB adapter using a connection string, set and get a value
Upgrade to Node.js >=12, mongoose ^6 or mongodb ^4
Use 'db' with a Db instance or 'url' with connection string
Call mongoose.connect() before creating KeyvMongoDB instance
Use import or require with .default
import KeyvMongoDB from 'keyv-mongodb' or const KeyvMongoDB = require('keyv-mongodb').defaultPass a valid url option or reuse an existing connection