From 5f575b197d1d94ba75f8f728f45147d0b63893ea Mon Sep 17 00:00:00 2001 From: Peter Schmidt Date: Thu, 24 Nov 2016 16:24:21 +1100 Subject: [PATCH] Try turning off the cache so we get a new instance --- lib/fetch.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/fetch.js b/lib/fetch.js index d961c0e..b08c8e7 100644 --- a/lib/fetch.js +++ b/lib/fetch.js @@ -34,7 +34,7 @@ function attach(anything, done) { function getIndexes(done, results) { var db = results.db; var ns = mongodbNS(results.namespace); - db.db(ns.database, {readPreference: {mode: READ}}).collection(ns.collection).indexes(function(err, indexes) { + db.db(ns.database, {readPreference: {mode: READ}, returnNonCachedInstance: true}).collection(ns.collection).indexes(function(err, indexes) { if (err) { done(err); } @@ -58,7 +58,7 @@ function getIndexStats(done, results) { { $indexStats: { } }, { $project: { name: 1, usageHost: '$host', usageCount: '$accesses.ops', usageSince: '$accesses.since' } } ]; - var collection = db.db(ns.database, {readPreference: {mode: READ}}).collection(ns.collection); + var collection = db.db(ns.database, {readPreference: {mode: READ}, returnNonCachedInstance: true}).collection(ns.collection); collection.aggregate(pipeline, function(err, res) { if (err) { if (isNotAuthorizedError(err)) { @@ -92,7 +92,7 @@ function getIndexStats(done, results) { function getIndexSizes(done, results) { var db = results.db; var ns = mongodbNS(results.namespace); - db.db(ns.database, {readPreference: {mode: READ}}).collection(ns.collection).stats(function(err, res) { + db.db(ns.database, {readPreference: {mode: READ}, returnNonCachedInstance: true}).collection(ns.collection).stats(function(err, res) { if (err) { if (isNotAuthorizedError(err)) { debug('Not authorized to get collection stats. Returning default for indexSizes {}.');