mongodb-moment

Make the mongodb node driver able to serialize moment.js objects

Downloads in past

Stats

StarsIssuesVersionUpdatedCreatedSize
mongodb-moment
201.0.24 years ago7 years agoMinified + gzip package size for mongodb-moment in KB

Readme

mongodb-moment
Make the mongodb node driver able to serialize moment.js objects.
Build Status

It example

const moment = require('moment');
require('mongodb-moment')(moment);

co(function*() {
  const id = new mongodb.ObjectId();
  yield db.collection('test').
    insertOne({ _id: id, createdAt: moment.utc('2011-06-01') });

  const res = yield db.collection('test').findOne();
  assert.deepEqual(res, { _id: id, createdAt: new Date('2011-06-01') });
  // acquit:ignore:start
  done();
  // acquit:ignore:end
})
// acquit:ignore:start
.catch(done);
// acquit:ignore:end