From db3ec0b3c93f9843bfab0cecfccd5bb5a5d66b74 Mon Sep 17 00:00:00 2001 From: fatjonny Date: Wed, 15 Aug 2012 15:37:54 -0500 Subject: [PATCH] Adds safe:true to set function. Makes the functionality expected from calling req.session.save(fn) actually happen by waiting for the response from the database before calling the callback function. --- lib/connect-mongodb.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/connect-mongodb.js b/lib/connect-mongodb.js index dd477f1..a8c99f1 100644 --- a/lib/connect-mongodb.js +++ b/lib/connect-mongodb.js @@ -143,7 +143,7 @@ MONGOSTORE.prototype.set = function (sid, sess, cb) { update.expires = Date.parse(sess.cookie.expires); } - _collection.update({_id: sid}, update, {upsert: true}, function (err, data) { + _collection.update({_id: sid}, update, {upsert: true, safe: true}, function (err, data) { cb.apply(this, arguments); }); };