Skip to content

Commit e84ff06

Browse files
committed
Merge pull request #3733 from dbkup/3.8.x
fix erroneous change in #3730
2 parents c9ae762 + c112f98 commit e84ff06

File tree

1 file changed

+5
-6
lines changed

1 file changed

+5
-6
lines changed

lib/aggregate.js

+5-6
Original file line numberDiff line numberDiff line change
@@ -80,8 +80,9 @@ Aggregate.prototype.bind = function (model) {
8080
*/
8181

8282
Aggregate.prototype.append = function () {
83-
var args = utils.args(arguments)
84-
, arg;
83+
var args = (1 === arguments.length && util.isArray(arguments[0]))
84+
? arguments[0]
85+
: utils.args(arguments);
8586

8687
if (!args.every(isOperator)) {
8788
throw new Error("Arguments must be aggregate pipeline operators");
@@ -265,14 +266,12 @@ Aggregate.prototype.near = function (arg) {
265266
*/
266267

267268
Aggregate.prototype.unwind = function () {
268-
var args = (1 === arguments.length && util.isArray(arguments[0]))
269-
? arguments[0]
270-
: utils.args(arguments);
269+
var args = utils.args(arguments);
271270

272271
return this.append.apply(this, args.map(function (arg) {
273272
return { $unwind: '$' + arg };
274273
}));
275-
}
274+
};
276275

277276
/**
278277
* Appends a new $sort operator to this aggregate pipeline.

0 commit comments

Comments
 (0)