Updated mongoose

This commit is contained in:
Dobie Wollert
2015-11-24 22:08:58 -08:00
parent 71a05fb732
commit 8b5827c970
618 changed files with 122299 additions and 37754 deletions

View File

@ -15,7 +15,7 @@ var utils = require('../utils');
* @api private
*/
function Mixed (path, options) {
function Mixed(path, options) {
if (options && options.default) {
var def = options.default;
if (Array.isArray(def) && 0 === def.length) {
@ -25,20 +25,28 @@ function Mixed (path, options) {
utils.isObject(def) &&
0 === Object.keys(def).length) {
// prevent odd "shared" objects between documents
options.default = function () {
return {}
}
options.default = function() {
return {};
};
}
}
SchemaType.call(this, path, options);
};
SchemaType.call(this, path, options, 'Mixed');
}
/**
* This schema type's name, to defend against minifiers that mangle
* function names.
*
* @api private
*/
Mixed.schemaName = 'Mixed';
/*!
* Inherits from SchemaType.
*/
Mixed.prototype.__proto__ = SchemaType.prototype;
Mixed.prototype = Object.create( SchemaType.prototype );
Mixed.prototype.constructor = Mixed;
/**
* Required validator
@ -46,8 +54,8 @@ Mixed.prototype.__proto__ = SchemaType.prototype;
* @api private
*/
Mixed.prototype.checkRequired = function (val) {
return true;
Mixed.prototype.checkRequired = function(val) {
return (val !== undefined) && (val !== null);
};
/**
@ -59,7 +67,7 @@ Mixed.prototype.checkRequired = function (val) {
* @api private
*/
Mixed.prototype.cast = function (val) {
Mixed.prototype.cast = function(val) {
return val;
};
@ -71,7 +79,7 @@ Mixed.prototype.cast = function (val) {
* @api private
*/
Mixed.prototype.castForQuery = function ($cond, val) {
Mixed.prototype.castForQuery = function($cond, val) {
if (arguments.length === 2) return val;
return $cond;
};