Hi,
I am having the list of users id and i need ti find the active users from the list in session collecction by passing the list of user ids. The session collection lokks like below
{
"_id" : "sXfI3vMxkZzsTkxuovUFONYA",
"session" : "{\"cookie\":{\"originalMaxAge\":14399998,\"expires\":\"2015-03-28T17:24:18.996Z\",\"secure\":true,\"httpOnly\":true,\"path\":\"/\"},\"lastAccess\":1427549058996,\"dbname\":\"abc\",\"userid\":\"54f5bfb0336a15084785c379\"}",
"expires" : 1427563458000
}
{
"_id" : "sXfI3vMxkZzsTkxuovUFONYB",
"session" : "{\"cookie\":{\"originalMaxAge\":14399998,\"expires\":\"2015-03-28T17:24:18.996Z\",\"secure\":true,\"httpOnly\":true,\"path\":\"/\"},\"lastAccess\":1427549058996,\"dbname\":\"abc\",\"userid\":\"54f5bfb0336a15084785c371\"}",
"expires" : 1427563458000
}
{
"_id" : "sXfI3vMxkZzsTkxuovUFONYC",
"session" : "{\"cookie\":{\"originalMaxAge\":14399998,\"expires\":\"2015-03-28T17:24:18.996Z\",\"secure\":true,\"httpOnly\":true,\"path\":\"/\"},\"lastAccess\":1427549058996,\"dbname\":\"abc\",\"userid\":\"54f5bfb0336a15084785c370\"}",
"expires" : 1427563458000
}
I am user id list like ["54f5bfb0336a15084785c379","54f5bfb0336a15084785c371"] as "userList".
I am querying like db.sessions.find({"session.cookie.userid":{$in:userList}}) and i am getting null as result.
When i query like below i am able to get the result.
db.sessions.find({"session":/54f5bfb0336a15084785c379/})
But i need to find the list of active users from the users list listing node js mongodb client. Can anyone help me in this please?