diff --git a/lib/fast_legs/base.js b/lib/fast_legs/base.js index 94d047a..125bea4 100644 --- a/lib/fast_legs/base.js +++ b/lib/fast_legs/base.js @@ -22,6 +22,8 @@ Base.prototype.truncate = function(opts, callback) { if (typeof opts === 'function') { callback = opts; opts = {}; + } else { + opts = _.clone(opts); } var truncateStatement = Statements.truncate(this, opts); @@ -53,6 +55,9 @@ Base.prototype.create = function(obj, callback) { if (_.isFunction(opts)) { callback = opts; opts = {}; + } else { + /* Do not modify opts, which may be global. */ + opts = _.clone(opts); } if (finder === 'findOne') opts.limit = 1;