mongo-schema
Advanced tools
Comparing version 0.1.2 to 0.1.3
@@ -1,3 +0,1 @@ | ||
var has_require = typeof require !== 'undefined'; | ||
var MongoSchema = function () { | ||
@@ -35,2 +33,3 @@ var self = this; | ||
if (!schema.hasOwnProperty(key)) continue; | ||
var value = data[key]; | ||
@@ -40,3 +39,3 @@ var properties = schema[key]; | ||
if (!isArray(value)) { | ||
delete data[key]; | ||
data[key] = []; | ||
continue; | ||
@@ -50,4 +49,6 @@ } else { | ||
} else if (isObject(properties) && !isNull(properties) && !isDefObject(properties) && !normalizeType(properties)) { | ||
var errs = self.check(value, properties); | ||
errors = errors.concat(errs); | ||
if(!isUndefined(value)){ | ||
var errs = self.check(value, properties); | ||
errors = errors.concat(errs); | ||
} | ||
} else { | ||
@@ -54,0 +55,0 @@ var type; |
{ | ||
"name": "mongo-schema", | ||
"version": "0.1.2", | ||
"version": "0.1.3", | ||
"main": "lib/mongo-schema.js", | ||
@@ -5,0 +5,0 @@ "description": "Basic schema for mongodb", |
48840
12
1049