Skip to content

Commit d9a2027

Browse files
spederivacdimitroulas
authored andcommittedJul 2, 2019
fix bug: Using options in aggregates doesn't set anything
1 parent 75daf18 commit d9a2027

File tree

3 files changed

+510
-508
lines changed

3 files changed

+510
-508
lines changed
 

‎lib/aggregate.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -564,7 +564,7 @@ Aggregate.prototype.allowDiskUse = function(value) {
564564
*/
565565

566566
Aggregate.prototype.option = function(value) {
567-
for (var key in Object.keys(value)) {
567+
for (var key in value) {
568568
this.options[key] = value[key];
569569
}
570570
return this;

‎package-lock.json

+506-506
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎test/aggregate.test.js

+3-1
Original file line numberDiff line numberDiff line change
@@ -854,7 +854,7 @@ describe('aggregate: ', function() {
854854
});
855855
});
856856

857-
it('handles aggregation options', function(done) {
857+
it('handles aggregation options allowDiskUse', function(done) {
858858
start.mongodVersion(function(err, version) {
859859
if (err) {
860860
throw err;
@@ -867,11 +867,13 @@ describe('aggregate: ', function() {
867867
var aggregate = m.aggregate(match).read(pref);
868868
if (mongo26_or_greater) {
869869
aggregate.allowDiskUse(true);
870+
aggregate.option({maxTimeMS: 1000});
870871
}
871872

872873
assert.equal(aggregate.options.readPreference.mode, pref);
873874
if (mongo26_or_greater) {
874875
assert.equal(aggregate.options.allowDiskUse, true);
876+
assert.equal(aggregate.options.maxTimeMS, 1000);
875877
}
876878

877879
aggregate.

0 commit comments

Comments
 (0)
Please sign in to comment.