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.
- NodeJS 10.x is a requirement to install dependencies, build and run tests.
- MongoDB database.
npm install botbuilder-storage-mongodbconst mongoStorage = new MongoDbStorage({
url : "mongodb://localhost:27017/",
database: "botframework",
collection: "botframework"
});
const conversationState = new ConversationState(mongoStorage);See example code for more details.
| 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
urlfrom 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.