mongoose 3.8.36 → 3.8.40
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/History.md +17 -0
- package/bin/mongoose.min.js +10 -10
- package/lib/aggregate.js +4 -3
- package/lib/document.js +2 -1
- package/lib/query.js +1 -1
- package/lib/schema/buffer.js +3 -0
- package/package.json +2 -2
package/lib/aggregate.js
CHANGED
|
@@ -80,8 +80,9 @@ Aggregate.prototype.bind = function (model) {
|
|
|
80
80
|
*/
|
|
81
81
|
|
|
82
82
|
Aggregate.prototype.append = function () {
|
|
83
|
-
var args =
|
|
84
|
-
|
|
83
|
+
var args = (1 === arguments.length && util.isArray(arguments[0]))
|
|
84
|
+
? arguments[0]
|
|
85
|
+
: utils.args(arguments);
|
|
85
86
|
|
|
86
87
|
if (!args.every(isOperator)) {
|
|
87
88
|
throw new Error("Arguments must be aggregate pipeline operators");
|
|
@@ -270,7 +271,7 @@ Aggregate.prototype.unwind = function () {
|
|
|
270
271
|
return this.append.apply(this, args.map(function (arg) {
|
|
271
272
|
return { $unwind: '$' + arg };
|
|
272
273
|
}));
|
|
273
|
-
}
|
|
274
|
+
};
|
|
274
275
|
|
|
275
276
|
/**
|
|
276
277
|
* Appends a new $sort operator to this aggregate pipeline.
|
package/lib/document.js
CHANGED
|
@@ -732,7 +732,8 @@ Document.prototype.get = function (path, type) {
|
|
|
732
732
|
*/
|
|
733
733
|
|
|
734
734
|
Document.prototype.$__path = function (path) {
|
|
735
|
-
var
|
|
735
|
+
var base = this.$__
|
|
736
|
+
, adhocs = (base) ? base.adhocPaths : undefined
|
|
736
737
|
, adhocType = adhocs && adhocs[path];
|
|
737
738
|
|
|
738
739
|
if (adhocType) {
|
package/lib/query.js
CHANGED
|
@@ -1757,7 +1757,7 @@ Query.prototype.update = function (conditions, doc, options, callback) {
|
|
|
1757
1757
|
// validate the update part of the query
|
|
1758
1758
|
var castedDoc;
|
|
1759
1759
|
try {
|
|
1760
|
-
castedDoc = this._castUpdate(utils.clone(doc),
|
|
1760
|
+
castedDoc = this._castUpdate(utils.clone(doc, { retainKeyOrder: true }),
|
|
1761
1761
|
options && options.overwrite);
|
|
1762
1762
|
} catch (err) {
|
|
1763
1763
|
if (callback) {
|
package/lib/schema/buffer.js
CHANGED
|
@@ -112,6 +112,9 @@ SchemaBuffer.prototype.cast = function (value, doc, init) {
|
|
|
112
112
|
|
|
113
113
|
var type = typeof value;
|
|
114
114
|
if ('string' == type || 'number' == type || Array.isArray(value)) {
|
|
115
|
+
if (type === 'number') {
|
|
116
|
+
value = [value];
|
|
117
|
+
}
|
|
115
118
|
var ret = new MongooseBuffer(value, [this.path, doc]);
|
|
116
119
|
return ret;
|
|
117
120
|
}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "mongoose"
|
|
3
3
|
, "description": "Mongoose MongoDB ODM"
|
|
4
|
-
, "version": "3.8.
|
|
4
|
+
, "version": "3.8.40"
|
|
5
5
|
, "author": "Guillermo Rauch <guillermo@learnboost.com>"
|
|
6
6
|
, "keywords": ["mongodb", "document", "model", "schema", "database", "odm", "data", "datastore", "query", "nosql", "orm", "db"]
|
|
7
7
|
, "dependencies": {
|
|
@@ -13,7 +13,7 @@
|
|
|
13
13
|
, "mpromise": "0.4.3"
|
|
14
14
|
, "mpath": "0.1.1"
|
|
15
15
|
, "regexp-clone": "0.0.1"
|
|
16
|
-
, "mquery" : "1.
|
|
16
|
+
, "mquery" : "1.10.0"
|
|
17
17
|
}
|
|
18
18
|
, "devDependencies": {
|
|
19
19
|
"mocha": "1.12.0"
|