Skip to content

Commit

Permalink
feat(aggregate): support hit field for aggregate command
Browse files Browse the repository at this point in the history
Supports passing an index hint to the aggregate command
  • Loading branch information
daprahamian committed Nov 10, 2017
1 parent b975df1 commit aa7da15
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions lib/collection.js
Original file line number Diff line number Diff line change
Expand Up @@ -2460,6 +2460,7 @@ Collection.prototype.aggregate = function(pipeline, options, callback) {
opts.cursor ||
opts.out ||
opts.maxTimeMS ||
opts.hint ||
opts.allowDiskUse)
? args.pop()
: {};
Expand Down Expand Up @@ -2504,6 +2505,9 @@ Collection.prototype.aggregate = function(pipeline, options, callback) {
if (options.allowDiskUse) command.allowDiskUse = options.allowDiskUse;
if (typeof options.maxTimeMS === 'number') command.maxTimeMS = options.maxTimeMS;

// If we are giving a hint
if (options.hint) command.hint = options.hint;

options = shallowClone(options);
// Ensure we have the right read preference inheritance
options = getReadPreference(this, options, this.s.db, this);
Expand Down

0 comments on commit aa7da15

Please sign in to comment.