Skip to content

Instantly share code, notes, and snippets.

@mrwithersea
Last active July 28, 2017 10:39
Show Gist options
  • Save mrwithersea/66710200d54aacbe7c46c16a006db355 to your computer and use it in GitHub Desktop.
Save mrwithersea/66710200d54aacbe7c46c16a006db355 to your computer and use it in GitHub Desktop.
Get mongo records started this week
const { ObjectID } = require('mongodb');
const moment = require('moment');
const thisWeek = moment().startOf('isoWeek').unix();
const week = yield db.collection('records').find({
_id: {
$gt: ObjectID.createFromTime(thisWeek)
}
}).count();
console.log(week);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment