Secbone / koa-session2

Middleware for Koa2 to get/set session
MIT License
153 stars 30 forks source link

how to use it with mongodb #33

Closed jackple closed 7 years ago

jackple commented 7 years ago

Is there a demo

Secbone commented 7 years ago

@jackple no demo for MongoDB yet, but it is very similar to Redis demo in README docs. For example, you can replace Redis in get method with MongoDB like this:

async get(sid) {
        // this just an instance, something like this
        let data = await this.mongo.findOne({sessionid: sid});
        return JSON.parse(data);
}
jackple commented 7 years ago

@Secbone Thanks! I will try later