@keyv/mongo
TypeScript icon, indicating that this package has built-in type declarations

2.2.8 • Public • Published

@keyv/mongo keyv

MongoDB storage adapter for Keyv

build codecov npm 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

/@keyv/mongo/

    Package Sidebar

    Install

    npm i @keyv/mongo

    Weekly Downloads

    3,126

    Version

    2.2.8

    License

    MIT

    Unpacked Size

    26 kB

    Total Files

    10

    Last publish

    Collaborators

    • jaredwray
    • lukechilds