Comparing version 2.0.0 to 2.0.1
@@ -74,2 +74,19 @@ 'use strict' | ||
function mappedArray (name) { | ||
return function () { | ||
var args = arguments | ||
var proto = this.prototype | ||
return get(this) | ||
.then(function (c) { | ||
return c[name].apply(c, args).toArray() | ||
}) | ||
.then(function (array) { | ||
array.forEach(function (doc) { | ||
doc[PROTO] = proto | ||
}) | ||
return array | ||
}) | ||
} | ||
} | ||
function mappedRawResult (name) { | ||
@@ -110,7 +127,10 @@ return function () { | ||
;['find', 'findOne', 'findAndModify'] | ||
.forEach(function (name) { | ||
Document[name] = mapped(name) | ||
}) | ||
Document.findOne = mapped('findOne') | ||
Document.findAndModify = mapped('findAndModify') | ||
Document.find = mappedArray('find') | ||
Document._collection = function () { | ||
return get(this) | ||
} | ||
;['update', 'remove', 'aggregate', 'ensureIndex'] | ||
@@ -117,0 +137,0 @@ .forEach(function (name) { |
{ | ||
"name": "mong", | ||
"version": "2.0.0", | ||
"version": "2.0.1", | ||
"description": "Lightweight models for mongodb objects", | ||
@@ -5,0 +5,0 @@ "main": "lib/index", |
Possible typosquat attack
Supply chain riskThere is a package with a similar name that is downloaded much more often.
Did you mean |
---|
monk |
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
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
15245
401
0
1