From 489fddb86869adfbf5e285aa5a9ce81143c48bc4 Mon Sep 17 00:00:00 2001 From: Hunter Loftis Date: Wed, 15 Oct 2014 12:57:26 -0700 Subject: [PATCH] allow disabling of cache to optionally query for latest results --- lib/cache.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/cache.js b/lib/cache.js index 39501bf..c9c5da6 100644 --- a/lib/cache.js +++ b/lib/cache.js @@ -10,8 +10,8 @@ exports.install = module.exports.install = function(mongoose, options) { exec: mongoose.Query.prototype.exec }; - mongoose.Query.prototype.cache = function() { - this.__cached = true; + mongoose.Query.prototype.cache = function(enabled) { + this.__cached = enabled === false ? false : true; return this; };