msbotframework-mongo-middlelayer icon indicating copy to clipboard operation
msbotframework-mongo-middlelayer copied to clipboard

Seems not to store user data

Open zubcomandante opened this issue 9 years ago • 6 comments

Hi, I've successfully connected my chatbot with MongoDB using your tool, thank you for your work :D However, it does not seem to properly store session.userData entities: my chatbot, which is fully working under native persistence support, prompts the user for his name at beginning, storing it at session.userData.name; with MongoDB, user name and other user data do not appear to be actually stored, while conversation data are (e.g. call stack). Please have a look at my DB dump, taken just after asking to store the given user name ("Marco"):

/* 1 / { "_id" : ObjectId("5979e97ccc3f5d6dbfa9eb2a"), "userid" : "mg5n2g17dj58l35f,default-user", "data" : { "BotBuilder@Data@SessionState" : { "callstack" : [ { "id" : ":/", "state" : { "BotBuilder@Data@WaterfallStep" : 1 } }, { "id" : "BotBuilder:prompt-choice", "state" : { "options" : { "listStyle" : 3, "prompt" : "Che cosa vuoi fare?", "choices" : [ { "value" : "Aprire un nuovo intervento." }, { "value" : "Visualizzare i miei interventi." } ], "promptAfterAction" : true, "retryPrompt" : null, "libraryNamespace" : "*" }, "turns" : 0, "lastTurn" : 1501161878091.0, "isReprompt" : false } } ], "lastAccess" : 1501161878068.0, "version" : 1.2 } }, "isCompressed" : false }

/* 2 */ { "_id" : ObjectId("5979e97ccc3f5d6dbfa9eb2c"), "userid" : "mg5n2g17dj58l35f,conversationData", "data" : {}, "isCompressed" : false }


I've noticed that "userId" value in object #2 looks a bit strange: can it be the problem?

Thank you very much, looking forward to your reply

Marco

zubcomandante avatar Jul 27 '17 13:07 zubcomandante

hi what channel you are using to communicate with bot? i believe that you are using Bot Framework Emulator.Id is correct. and i tested same code on Bot Framework Emulator and slack.It is working fine for me

aakashkag avatar Jul 27 '17 14:07 aakashkag

Hi! I'm using the emulator locally and Skype/Telegram remotely, same result.

Thank you for your super-quick feedback :)

zubcomandante avatar Jul 27 '17 14:07 zubcomandante

I will look into this issue soon . Thanks

aakashkag avatar Jul 27 '17 14:07 aakashkag

I created video which demonstrate how You can store session and user data into mongo db https://youtu.be/S0oO81oG2GY

aakashkag avatar Jul 27 '17 18:07 aakashkag

Thank you very much, finally I found there was a side-effect in my code that prevented it from working properly with MongoDB: it looks like session.reset() behaves differently under native persistence and external persistence; I will go deeper into that. In any case, your update was clean and useful 👍

P.S.: did you have a look at the other issue I opened?

zubcomandante avatar Jul 28 '17 09:07 zubcomandante

if u want to clean userdata then use session.userData={} No,i didn't look into second issue

aakashkag avatar Jul 28 '17 09:07 aakashkag