Mongodb Implements exists De-duplication

  mongodb, question
db.getCollection('user').save({"uid":"1123", "logTime":ISODate('2016-05-23 11:11:23')});
 db.getCollection('user').save({"uid":"1124", "logTime":ISODate('2016-05-23 05:11:23')});
 db.getCollection('user').save({"uid":"1125", "logTime":ISODate('2016-05-23 08:11:23')});
 db.getCollection('user').save({"uid":"1126", "logTime":ISODate('2016-05-23 09:12:23')});
 db.getCollection('user').save({"uid":"1127", "logTime":ISODate('2016-05-23 11:23:23')});
 db.getCollection('user').save({"uid":"1134", "logTime":ISODate('2016-05-23 11:11:23')});
 db.getCollection('user').save({"uid":"1123", "logTime":ISODate('2016-05-21 11:11:23')});
 db.getCollection('user').save({"uid":"1125", "logTime":ISODate('2016-05-22 11:11:23')});
 db.getCollection('user').save({"uid":"2343", "logTime":ISODate('2016-04-23 11:11:23')});
 db.getCollection('user').save({"uid":"9873", "logTime":ISODate('2016-04-23 11:11:23')});
 db.getCollection('user').save({"uid":"4321", "logTime":ISODate('2016-04-20 11:11:23')});

The above simulated some data to produce a user set to represent the user login status. now I want to inquire about the new number of users on may 23, 2016 (the number of users logged in on may 23 but does not exist in the records less than may 23). for example, if the first record uid=’1123′ was also logged in on may 21, then uid=’1123′ is not counted in the number of users logged in on may 23.

Mongodb does not support join. The following method can achieve your goal

var list = [];
 db.getCollection('user').find({'logTime': {'$lt': ISODate('2016-05-23')}}, {'_id': 0, 'uid': 1}).forEach(function(item){
 list.push(item['uid']);
 });
 
 db.getCollection('user').find({'logTime': {'$gte': ISODate('2016-05-23')}, 'uid': {'$nin': list}});