Comparing version 2.1.0 to 2.2.0
@@ -0,1 +1,5 @@ | ||
## 2.2.0/2016-10-04 | ||
- add default `_id` schema when register a new schema | ||
## 2.1.0/2016-09-18 | ||
@@ -2,0 +6,0 @@ |
@@ -5,4 +5,11 @@ 'use strict'; | ||
const Schema = require('another-json-schema'); | ||
const Types = require('./Types'); | ||
exports.Schema = Schema; | ||
class _Schema extends Schema { | ||
constructor(name, schema) { | ||
super(name, _.defaults(schema, { _id: { type: Types.ObjectId } })); | ||
} | ||
} | ||
exports.Schema = _Schema; | ||
exports._plugins = function _plugins(schema) { | ||
@@ -9,0 +16,0 @@ return { |
{ | ||
"name": "mongolass", | ||
"version": "2.1.0", | ||
"version": "2.2.0", | ||
"description": "Elegant MongoDB driver for Node.js.", | ||
@@ -5,0 +5,0 @@ "main": "lib/index.js", |
@@ -37,3 +37,3 @@ 'use strict'; | ||
} | ||
assert.deepEqual(error.message, 'Already connected to mongodb://localhost:27017/test, please create another connection.'); | ||
assert.deepEqual(error.message, 'Already connected to ' + MONGODB + ', please create another connection.'); | ||
}); | ||
@@ -72,4 +72,13 @@ | ||
}); | ||
assert.ok(UserSchema._schema._id); | ||
assert.ok(UserSchema instanceof Schema); | ||
assert.ok(UserSchema === mongolass.schema('User')); | ||
UserSchema = new Schema('User', { | ||
name: { type: 'string' }, | ||
age: { type: 'number', range: [0, 100] } | ||
}); | ||
assert.ok(UserSchema._schema._id); | ||
assert.ok(UserSchema instanceof Schema); | ||
try { | ||
@@ -76,0 +85,0 @@ UserSchema = mongolass.schema('User2'); |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
69947
1910