algomaks / botbuilder-storage-mongodb

Repository from Github https://github.comalgomaks/botbuilder-storage-mongodbRepository from Github https://github.comalgomaks/botbuilder-storage-mongodb

State Storage for Bot Framework using MongoDB

This project provides a MongoDb storage mechanism for Bot Framework-JS SDK V4..

It allows you to store bot state in MongoDB, so that you can scale out your bot, and be more resilient to bot server failures.

Build Status

Requirements

  • NodeJS 10.x is a requirement to install dependencies, build and run tests.
  • MongoDB database.

Installation

npm install botbuilder-storage-mongodb

Sample Usage

const mongoStorage = new MongoDbStorage({
  url : "mongodb://localhost:27017/",
  database: "botframework",
  collection: "botframework"
});

const conversationState = new ConversationState(mongoStorage);

See example code for more details.

Configuration Options

Field Description Value
url The URL of the mongo server Required
database The name of the database where state will be stored Optional. Default "BotFramework"
collection The name of the collection where the state documents will be stored. Optional. Default "BotFrameworkState"

⚠ Caution: you should not store Mongo URL in code! Get the url from a configuration such as environment variable or a secrets store in your environment. It may contain sensitive password in the clear and should never be stored in code!

See MongoDB Connection URI format in the official documentation to learn more about the connection url parameter value.

About

License:MIT License


Languages

Language:JavaScript 85.3%Language:TypeScript 14.7%