0.1.1 • Published 12 years ago

timestamp-objectid v0.1.1

Weekly downloads
242
License
-
Repository
github
Last release
12 years ago

Be able to query mongodb records in the given timeperiod by ObjectId

var timestampToObjectId = require('timestamp-objectId');
// timestampToObjectId = function(timestamp)
// timestamp could be both String and actual Timestamp

db.mycollection.find({
  _id: {
    $gt: timestampToObjectId('1980/05/25'),
    $lt: timestampToObjectId(1367413318476)
  }
});

...