From efa78f0f72388e567a96c6427527dacfae3fa9c1 Mon Sep 17 00:00:00 2001 From: bojidaryovchev Date: Tue, 16 Jan 2018 03:38:34 +0200 Subject: [PATCH] fix(collection): ensure dynamic require of `db` is wrapped in parentheses This is a fix for issue https://github.com/webpack/webpack/issues/6191 Needed to surround the require statement with parenthesis to make its priority higher. --- lib/collection.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/collection.js b/lib/collection.js index 2d70e6e003..a00af096f5 100644 --- a/lib/collection.js +++ b/lib/collection.js @@ -3001,7 +3001,7 @@ 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')( + collection = new (require('./db'))( doc.db, self.s.db.s.topology, self.s.db.s.options