Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

update mongodb store to return the id after put #35

Merged
merged 1 commit into from Oct 1, 2012
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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 // .insert() returns array, we need the first element
obj = obj && obj[0]; obj = obj && obj[0];
if (obj) delete obj._id; if (obj) delete obj._id;
deferred.resolve(obj); deferred.resolve(obj.id);
}); });
} else { } else {
deferred.reject(id + " exists, and can't be overwritten"); 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){ collection.update(search, object, {upsert: directives.overwrite}, function(err, obj){
if (err) return deferred.reject(err); if (err) return deferred.reject(err);
if (obj) delete obj._id; if (obj) delete obj._id;
deferred.resolve(obj); deferred.resolve(id);
}); });
} }
return deferred; return deferred;
Expand Down