From a565dbbd12aa79c4498e41f3c8d165cbf16b4b24 Mon Sep 17 00:00:00 2001 From: Timothy Marks Date: Sat, 28 Jul 2012 22:37:48 +1000 Subject: [PATCH] Fixes issue where only id would be saved when updating an existing object for mongodb driver. .save instead of .update was being called which would persist only a data object with the id value to the database on doing a save of an existing object. --- lib/adapters/mongodb.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/adapters/mongodb.js b/lib/adapters/mongodb.js index 1f601bb3..7cab8c67 100644 --- a/lib/adapters/mongodb.js +++ b/lib/adapters/mongodb.js @@ -63,7 +63,7 @@ MongoDB.prototype.create = function (model, data, callback) { }; MongoDB.prototype.save = function (model, data, callback) { - this.collection(model).save({_id: new ObjectID(data.id)}, data, function (err) { + this.collection(model).update({_id: new ObjectID(data.id)}, data, function (err) { callback(err); }); };