Comparing version 2.2.0 to 2.3.0
@@ -0,1 +1,7 @@ | ||
## 2.3.0/2016-10-11 | ||
- model function cannot be modified now | ||
- add model function name | ||
- upgrade error stack | ||
## 2.2.0/2016-10-04 | ||
@@ -2,0 +8,0 @@ |
@@ -40,2 +40,4 @@ 'use strict'; | ||
constructor(op, args) { | ||
Error.captureStackTrace(this, this.constructor);// preserve stack | ||
this._op = op; | ||
@@ -95,13 +97,19 @@ this._args = args; | ||
function _bindMethod(propName) { | ||
ctx[propName] = (...args) => { | ||
if (args.length && ('function' === typeof args[args.length - 1])) { | ||
throw new TypeError('Not support callback for method: ' + propName + ', please call .exec() or .cursor()'); | ||
} | ||
if (['find', 'findOne'].indexOf(propName) !== -1) { | ||
if (args.length > 2) { | ||
throw new TypeError('Only support this usage: ' + propName + '(query, options)'); | ||
Object.defineProperty(ctx, propName, { | ||
enumerable: true, | ||
value: (...args) => { | ||
if (args.length && ('function' === typeof args[args.length - 1])) { | ||
throw new TypeError('Not support callback for method: ' + propName + ', please call .exec() or .cursor()'); | ||
} | ||
if (['find', 'findOne'].indexOf(propName) !== -1) { | ||
if (args.length > 2) { | ||
throw new TypeError('Only support this usage: ' + propName + '(query, options)'); | ||
} | ||
} | ||
return new Query(propName, args); | ||
} | ||
return new Query(propName, args); | ||
}; | ||
}); | ||
Object.defineProperty(ctx[propName], 'name', { | ||
value: propName | ||
}); | ||
} | ||
@@ -185,2 +193,4 @@ | ||
function addMongoErrorDetail(e) { | ||
// overwrite error stack | ||
e.stack = this.stack; | ||
//only for mongoError | ||
@@ -187,0 +197,0 @@ if (!e.model) { |
{ | ||
"name": "mongolass", | ||
"version": "2.2.0", | ||
"version": "2.3.0", | ||
"description": "Elegant MongoDB driver for Node.js.", | ||
@@ -5,0 +5,0 @@ "main": "lib/index.js", |
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
70349
1919