Skip to content

Latest commit

 

History

History
44 lines (29 loc) · 881 Bytes

README.md

File metadata and controls

44 lines (29 loc) · 881 Bytes

MongoDB Provider

This is a MongoDB provider for underflag (feature flag/feature toggle)

Install

Using npm:

npm install underflag-mongodb

Using yarn:

yarn add underflag-mongodb

How to use

Import the underflag and prepare to load data provider

import { Underflag } from "underflag";
import { MongodbDataProvider } from "underflag-mongodb";
import { MongoClient } from 'mongodb';

const client = new MongoClient(config.mongoUrl);
await client.connect();
const dataProvider = new MongodbDataProvider({ db: client.db() });
const underflag = new Underflag({ dataProvider });
if (await underflag.isOn("feature")) {
    // ...
}

Attention: Do not forget of create the features collection in mongodb with the key and value fields.

Know more on underflag npm page

License

MIT