Mongoose query by date

If find in today, using momentjs

// start today
var start = moment().startOf('day');
// end today
var end = moment(today).endOf('day');

Example.find({ validUntil: { '$gte': start, '$lte': end })

Use $gte like this :

Example.find({
    validUntil: {
        $gte: new Date(2016,09,30)
    }
})

get all created account today:

  let start = new Date(now.getFullYear(),now.getMonth(),now.getDate(),1,0,0);

  let end = new Date(now.getFullYear(),now.getMonth(),now.getDate()+1,0,59,59);

  let query = {createdAt: {$gte: start, $lt: end} };

  Account
  .find(query)
  .exec((err, accounts) => console.log(account) )