Comparing version 4.0.0 to 4.1.0
@@ -1,3 +0,8 @@ | ||
## 4.0.0/2018-01-03 | ||
## 4.1.0/2018-01-09 | ||
- upgrade another-json-schema@3.4.0 | ||
- update operators will not check `default` & `required` | ||
## 4.0.0/2018-01-08 | ||
- [feat] use eslint@standard | ||
@@ -4,0 +9,0 @@ - [feat] upgrade another-json-schema@3 |
@@ -238,3 +238,5 @@ const _ = require('lodash') | ||
additionalProperties: true, | ||
ignoreNodeType: true | ||
ignoreNodeType: true, | ||
required: false, | ||
default: false | ||
}) | ||
@@ -262,2 +264,7 @@ // try format, if false then pass | ||
function _formatUpdate (doc, schemaPath = '', parentDoc, parentKey, opts = {}) { | ||
// update operators will not check `default` & `required` | ||
_.defaults(opts, { | ||
required: false, | ||
default: false | ||
}) | ||
if (_.isPlainObject(doc)) { | ||
@@ -355,3 +362,7 @@ for (let key in doc) { | ||
let key = parentKey.split('.').slice(-1)[0] | ||
const result = schema._parent.validate({ [key]: doc }, { ignoreNodeType: true }) | ||
const result = schema._parent.validate({ [key]: doc }, { | ||
ignoreNodeType: true, | ||
required: false, | ||
default: false | ||
}) | ||
if (!result.valid) { | ||
@@ -358,0 +369,0 @@ throw result.error |
{ | ||
"name": "mongolass", | ||
"version": "4.0.0", | ||
"version": "4.1.0", | ||
"description": "Elegant MongoDB driver for Node.js.", | ||
"main": "lib/index.js", | ||
"scripts": { | ||
"pretest": "eslint .", | ||
"pretest": "./node_modules/.bin/eslint .", | ||
"test": "node ./node_modules/.bin/istanbul cover ./node_modules/.bin/_mocha" | ||
@@ -42,3 +42,3 @@ }, | ||
"dependencies": { | ||
"another-json-schema": "3.3.0", | ||
"another-json-schema": "3.4.0", | ||
"debug": "3.1.0", | ||
@@ -54,2 +54,3 @@ "inflected": "2.0.3", | ||
"co-mocha": "^1.2.1", | ||
"eslint": "4.15.0", | ||
"eslint-config-standard": "11.0.0-beta.0", | ||
@@ -56,0 +57,0 @@ "eslint-plugin-import": "2.8.0", |
@@ -42,2 +42,17 @@ const MONGODB = process.env.MONGODB || 'mongodb://localhost:27017/test' | ||
it('connect with auth', function * () { | ||
const mongolass2 = new Mongolass('mongodb://admin:123456@ds247587.mlab.com:47587/mongolass') | ||
const User = mongolass2.model('User') | ||
const name = Date.now() | ||
yield User.insert({ name }) | ||
const user = yield User.findOne({ name }) | ||
assert.ok(user) | ||
assert.ok(user._id) | ||
assert.deepEqual(user.name, name) | ||
yield mongolass2.disconnect() | ||
}) | ||
it('connect failed', function * () { | ||
@@ -44,0 +59,0 @@ let error |
@@ -10,3 +10,3 @@ const MONGODB = process.env.MONGODB || 'mongodb://localhost:27017/test' | ||
const UserSchema = new Schema('User', { | ||
name: { type: 'string' }, | ||
name: { type: 'string', required: true }, | ||
age: { type: 'number', range: [0, 100] }, | ||
@@ -124,3 +124,3 @@ refe: { type: Mongolass.Types.ObjectId }, | ||
actual: 1, | ||
expected: { type: 'string' }, | ||
expected: { type: 'string', required: true }, | ||
path: '$.name', | ||
@@ -163,3 +163,3 @@ schema: 'User', | ||
actual: 1, | ||
expected: { type: 'string' }, | ||
expected: { type: 'string', required: true }, | ||
path: '$.name', | ||
@@ -204,3 +204,3 @@ schema: 'User', | ||
actual: 1, | ||
expected: { type: 'string' }, | ||
expected: { type: 'string', required: true }, | ||
path: '$.name', | ||
@@ -660,3 +660,3 @@ schema: 'User', | ||
actual: 1, | ||
expected: { type: 'string' }, | ||
expected: { type: 'string', required: true }, | ||
path: '$.name', | ||
@@ -705,3 +705,3 @@ schema: 'User', | ||
actual: 1, | ||
expected: { type: 'string' }, | ||
expected: { type: 'string', required: true }, | ||
path: '$.name', | ||
@@ -728,3 +728,3 @@ schema: 'User', | ||
actual: 1, | ||
expected: { type: 'string' }, | ||
expected: { type: 'string', required: true }, | ||
path: '$.name', | ||
@@ -811,3 +811,3 @@ schema: 'User', | ||
actual: 1, | ||
expected: { type: 'string' }, | ||
expected: { type: 'string', required: true }, | ||
path: '$.name', | ||
@@ -814,0 +814,0 @@ schema: 'User', |
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
92223
2319
0
9
+ Addedanother-json-schema@3.4.0(transitive)
- Removedanother-json-schema@3.3.0(transitive)
Updatedanother-json-schema@3.4.0