Comparing version 0.6.3 to 0.6.4
0.6.4 / 2014-04-09 | ||
================== | ||
* fix $setOnInsert with empty obj cause mongodb 2.6 complain [@inetfuture] | ||
0.6.3 / 2014-04-07 | ||
@@ -3,0 +8,0 @@ ================== |
@@ -157,3 +157,4 @@ var Job = require('./job.js'), | ||
var now = new Date(), | ||
protect = {}; | ||
protect = {}, | ||
update; | ||
if(props.nextRunAt && props.nextRunAt <= now) { | ||
@@ -163,3 +164,9 @@ protect.nextRunAt = props.nextRunAt; | ||
} | ||
this._db.findAndModify({name: props.name, type: 'single'}, {}, { $set: props, $setOnInsert: protect }, {upsert: true, new: true}, processDbResult); | ||
update = { $set: props }; | ||
if (Object.keys(protect).length > 0) { | ||
update.$setOnInsert = protect; | ||
} | ||
this._db.findAndModify({name: props.name, type: 'single'}, {}, update, {upsert: true, new: true}, processDbResult); | ||
} else { | ||
@@ -166,0 +173,0 @@ if(job.attrs._id) { |
{ | ||
"name": "agenda", | ||
"version": "0.6.3", | ||
"version": "0.6.4", | ||
"description": "Light weight job scheduler for Node.js", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
49996
940