Hi, for my app i need to bring back from a collection all the people that were online on the past 30 mins (if someone was online 31 mins or more ago he won’t be returned).
I want to do most of the calculations on the client, so on the “on login” I calculate:
- the new Date(),
- getTime(),
- getTime() - 30 mins
and call a method on the server.
const date = new Date();
const time = date.getTime();
const thiry_mins_ago = time - 1806000;
Meteor.call('find_active_friends', thiry_mins_ago);
on the server i find() all the users with the “last_login” time grater than thiry_mins_ago, besides the actual user.
find_active_friends(thiry_mins_ago) {
let online_friends = UsersSummery.findOne( {"userId": {$ne: userId} }, {"last_login": {$gt: thiry_mins_ago} } );
console.log(online_friends);
}
however, on the test i did i got back a user with last login of 12367, while the thiry_mins_ago was 1501574394951.
any idea what did i do wrong?
thanks!