JSPM

  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 8967
  • Score
    100M100P100Q134532F
  • License MIT

MongoDB storage adapter for Keyv

Package Exports

  • @keyv/mongo

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (@keyv/mongo) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

@keyv/mongo keyv

MongoDB storage adapter for Keyv

build Coverage Status npm

MongoDB storage adapter for Keyv.

Uses TTL indexes to automatically remove expired documents. However MongoDB doesn't guarantee data will be deleted immediately upon expiration, so expiry dates are revalidated in Keyv.

Install

npm install --save keyv @keyv/mongo

Usage

const Keyv = require('keyv');

const keyv = new Keyv('mongodb://user:pass@localhost:27017/dbname');
keyv.on('error', handleConnectionError);

You can specify the collection name, by default 'keyv' is used.

e.g:

const keyv = new Keyv('mongodb://user:pass@localhost:27017/dbname', { collection: 'cache' });

License

MIT © Jared Wray & Luke Childs