mongodb-moment

1.0.2 • Public • Published

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

Dependencies (0)

    Dev Dependencies (7)

    Package Sidebar

    Install

    npm i mongodb-moment

    Weekly Downloads

    63

    Version

    1.0.2

    License

    none

    Unpacked Size

    14.8 kB

    Total Files

    7

    Last publish

    Collaborators

    • vkarpov15