Skip to content

Commit

Permalink
Merge remote-tracking branch 'linusbrolin/query-middleware-support' i…
Browse files Browse the repository at this point in the history
…nto query-middleware-support
  • Loading branch information
ramiel committed Aug 26, 2016
2 parents 48926a7 + 3bdcdee commit 0753518
Showing 1 changed file with 2 additions and 6 deletions.
8 changes: 2 additions & 6 deletions lib/sequence.js
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,7 @@ Sequence.prototype._setHooks = function() {
if (err) return next();
if (obj) return next();
else {
referenceValue = _this._getCounterReferenceField(_thisquery._update['$setOnInsert']);
referenceValue = _this._getCounterReferenceField(_thisquery._update);
_this._setNextCounter(_this._options.reference_fields, referenceValue, function(err, seq) {
if (err) return next();
_thisquery._update['$setOnInsert'] = _thisquery._update['$setOnInsert'] || {};
Expand All @@ -190,10 +190,6 @@ Sequence.prototype._setHooks = function() {
});
});

// this._schema.post('findOneAndUpdate', function(next) {
// console.dir(this);
// });

this._schema.pre('update', function(next, done) {
// jscs:disable
var _thisquery = this,
Expand All @@ -206,7 +202,7 @@ Sequence.prototype._setHooks = function() {
if (err) return next();
if (obj) return next();
else {
referenceValue = _this._getCounterReferenceField(_thisquery._update['$setOnInsert']);
referenceValue = _this._getCounterReferenceField(_thisquery._update);
_this._setNextCounter(_this._options.reference_fields, referenceValue, function(err, seq) {
if (err) return next();
_thisquery._update['$setOnInsert'] = _thisquery._update['$setOnInsert'] || {};
Expand Down

0 comments on commit 0753518

Please sign in to comment.