mongodb-moment
Advanced tools
Comparing version
{ | ||
"name": "mongodb-moment", | ||
"version": "1.0.1", | ||
"version": "1.0.2", | ||
"description": "Make the mongodb node driver able to serialize moment.js objects", | ||
@@ -15,14 +15,14 @@ "keywords": [ | ||
"devDependencies": { | ||
"acquit": "0.4.0", | ||
"acquit-ignore": "0.0.3", | ||
"acquit-markdown": "0.0.5", | ||
"acquit": "1.0.0", | ||
"acquit-ignore": "0.1.0", | ||
"acquit-markdown": "0.1.0", | ||
"co": "4.6.0", | ||
"mocha": "2.2.4", | ||
"moment": "2.1.x", | ||
"mongodb": "2.1.x" | ||
"mocha": "5.x", | ||
"moment": "~2.2", | ||
"mongodb": "3.x" | ||
}, | ||
"repository": { | ||
"type": "git", | ||
"url": "git://github.com/vkarpov15/mongodb-moment.git" | ||
"url": "git://github.com/boosterfuels/mongodb-moment.git" | ||
} | ||
} |
@@ -0,1 +1,3 @@ | ||
# mongodb-moment | ||
@@ -9,18 +11,22 @@ | ||
## example | ||
## It example | ||
```javascript | ||
const moment = require('moment'); | ||
require('mongodb-moment')(moment); | ||
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') }); | ||
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') }); | ||
}) | ||
``` | ||
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 | ||
``` |
@@ -13,2 +13,3 @@ 'use strict'; | ||
describe('mongodb-moment', function() { | ||
let client; | ||
let db; | ||
@@ -18,4 +19,5 @@ | ||
co(function*() { | ||
db = yield mongodb.MongoClient. | ||
connect('mongodb://localhost:27017/moment'); | ||
client = yield mongodb.MongoClient. | ||
connect('mongodb://localhost:27017/moment', { useNewUrlParser: true }); | ||
db = client.db(); | ||
yield db.dropDatabase(); | ||
@@ -26,2 +28,6 @@ done(); | ||
after(function() { | ||
return client.close(); | ||
}); | ||
it('example', function(done) { | ||
@@ -28,0 +34,0 @@ const moment = require('moment'); |
Sorry, the diff of this file is not supported yet
58
9.43%32
28%14805
-1.88%7
-12.5%