Last active
July 28, 2017 10:39
-
-
Save mrwithersea/66710200d54aacbe7c46c16a006db355 to your computer and use it in GitHub Desktop.
Get mongo records started this week
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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