botkit-storage-mongoose

1.0.3 • Public • Published

botkit-storage-mongoose

A MongoDB/Mongoose storage module for Botkit.

Usage

Just require botkit-storage-mongoose and pass it a config with a mongoUri option. Then pass the returned storage when creating your Botkit controller. Botkit will do the rest.

Make sure everything you store has an id property, that's what you'll use to look it up later.

var Botkit = require('botkit'),
    mongodbStorage = require('botkit-storage-mongoose')({mongoUri: '...', tables: ['TABLE1', 'TABLE2']}),
    controller = Botkit.slackbot({
        storage: mongodbStorage // or db: MongoDB-instance
    });
// then you can use the Botkit storage api, make sure you have an id property
var beans = {id: 'cool', beans: ['pinto', 'garbanzo']};
controller.storage.teams.save(beans);
beans = controller.storage.teams.get('cool');

Package Sidebar

Install

npm i botkit-storage-mongoose

Weekly Downloads

1

Version

1.0.3

License

MIT

Last publish

Collaborators

  • tejzpr