1
我需要檢索sessionStore(MongoStore)列表,會話和刪除以前的登錄會話。我正在使用快速會話將會話存儲在數據庫中。從sessionStore檢索會話列表並銷燬用戶以前各屆會議的NodeJS
var userId = req.query.userid;
if (!userId)
return res.status(400).send({
message: errorHandler.getErrorMessage('No user found in input request')
});
var store = req.sessionStore;
var sessionsColl = store.db.collection('sessions');
sessionsColl.find({
'session.passport.user': userId,
'_id': { '$ne': req.sessionID }
}, function (err, userSessions) {
console.log(userSessions);
if (userSessions !== null && typeof userSessions._id !== 'undefined') {
store.destroy(userSessions._id, function (err, dat) {
console.log(dat);
});
}
});
但userSessions對象我得到一個對象,而不是收集和我不明白我怎麼可以從userSessions對象