Am trying to fetch all session document based on user id so that i can redirect after they are successfully logged in any machine by storing the variable named like lastviewed and date in session document, Please guide me further am using connect-mongo for session storage
{
"_id" : "RMZQdKfh_qiBaJ66w-ojFmuKL92ymNN-",
"session" : "{\"cookie\":{\"originalMaxAge\":86399996,\"expires\":\"2017-03-17T14:29:56.298Z\",\"secure\":false,\"httpOnly\":true,\"path\":\"/\"},\"passport\":{\"user\":\"58c9443cfaca995c0c14d129\"},\"lastviewed\":\"/api/companies\"}",
"expires" : ISODate("2017-03-17T14:29:56.298+0000")
}
From the above document i just want query like this { 'session.passport.user':'user_id' }