othiym23 / node-continuation-local-storage

implementation of https://github.com/joyent/node/issues/5243
BSD 2-Clause "Simplified" License
1.13k stars 207 forks source link

Losing context in mongodb calls #112

Closed idanfelz closed 7 years ago

idanfelz commented 7 years ago

Hi, Im trying to add requestId to each log message. I doscover that this package is the only one that can do something like this. Im using mongodb version 2.2.11 and use promise chain to handle the result. When the result returns, the namespace losing the context before the mongo call. I tried to namespace.bind the function find({...}).toArray or findOne(...), using promises(My preferable way), and even tried it using callback style, but i get "cannot read property 's' of undefined". So i even dont have any workaround for the issue. Please help me to solve this! I tried everything to do the request tracking and i dont have anything! Thank you

idanfelz commented 7 years ago

i had another issue in my code that cause the problem.