Yoctol/bottender

mongoose config is out of date

dcsan opened this issue · 0 comments

dcsan commented

Describe the bug
creating a new bot with sessions-> mongoDB I get this message at the console:

(node:83117) DeprecationWarning: current Server Discovery and Monitoring engine is deprecated, and will be removed in a future version. To use the new Server Discover and Monitoring engine, pass option { useUnifiedTopology: true } to the MongoClient constructor.
(Use `node --trace-deprecation ...` to show where the warning was created)
npx create-bottender-app bot
npx: installed 63 in 7.906s
? What platform of bot do you want to create?
? Where do you want to store session? mongo
❯
❯ Creating a new Bottender bot at /Users/dc/dev/exiteer/xbot/bot.
❯
❯ Installing packages... This might take a couple of minutes.

....

$ npm run dev -- --console

> bot@0.1.0 dev /Users/dc/dev/exiteer/xbot/bot
> bottender dev "--console"

App has started
You > hi
hi
(node:83117) DeprecationWarning: current Server Discovery and Monitoring engine is deprecated, and will be removed in a future version. To use the new Server Discover and Monitoring engine, pass option { useUnifiedTopology: true } to the MongoClient constructor.
(Use `node --trace-deprecation ...` to show where the warning was created)
Bot > Welcome to Bottender
> hi
hi
Bot > Welcome to Bottender

To Reproduce
create new bot
run console

Expected behavior
This seems to be a mongoose related issue

this should fix it:

mongoose.set('useUnifiedTopology', true);

perhaps somewhere around here?

https://github.com/Yoctol/bottender/blob/master/packages/bottender/src/session/MongoSessionStore.ts#L37