Skip to content

Commit

Permalink
Change db instantiation in Collection#mapReduce:
Browse files Browse the repository at this point in the history
This makes the syntax friendly for use with Webpack.
  • Loading branch information
durran authored and mbroadst committed Jan 28, 2018
1 parent a34512b commit a45eb0b
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions lib/collection.js
Original file line number Diff line number Diff line change
Expand Up @@ -3008,11 +3008,10 @@ var mapReduce = function(self, map, reduce, options, callback) {
if (result.result != null && typeof result.result === 'object') {
var doc = result.result;
// Return a collection from another db
collection = new (require('./db'))(
doc.db,
self.s.db.s.topology,
self.s.db.s.options
).collection(doc.collection);
var Db = require('./db');
collection = new Db(doc.db, self.s.db.s.topology, self.s.db.s.options).collection(
doc.collection
);
} else {
// Create a collection object that wraps the result collection
collection = self.s.db.collection(result.result);
Expand Down

0 comments on commit a45eb0b

Please sign in to comment.