Skip to content

Commit

Permalink
Merge pull request #35 from neonstalwart/mongo-ids
Browse files Browse the repository at this point in the history
update mongodb store to return the id after `put`
  • Loading branch information
kriszyp committed Oct 1, 2012
2 parents 40c8a51 + 834bf90 commit 16aa238
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions store/mongodb.js
Expand Up @@ -275,7 +275,7 @@ module.exports = function(options){
// .insert() returns array, we need the first element
obj = obj && obj[0];
if (obj) delete obj._id;
deferred.resolve(obj);
deferred.resolve(obj.id);
});
} else {
deferred.reject(id + " exists, and can't be overwritten");
Expand All @@ -285,7 +285,7 @@ module.exports = function(options){
collection.update(search, object, {upsert: directives.overwrite}, function(err, obj){
if (err) return deferred.reject(err);
if (obj) delete obj._id;
deferred.resolve(obj);
deferred.resolve(id);
});
}
return deferred;
Expand Down

0 comments on commit 16aa238

Please sign in to comment.