Skip to content

diemsouza/underflag-mongodb

Repository files navigation

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

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published