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.
This commit is contained in:
Timothy Marks 2012-07-28 22:37:48 +10:00
parent 752e711bca
commit a565dbbd12
1 changed files with 1 additions and 1 deletions

View File

@ -63,7 +63,7 @@ MongoDB.prototype.create = function (model, data, callback) {
}; };
MongoDB.prototype.save = 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); callback(err);
}); });
}; };