Skip to content

Commit

Permalink
datastore: return a mix of auto-inserted and already existing keys. f…
Browse files Browse the repository at this point in the history
…ixes #17.
  • Loading branch information
rakyll committed Jul 11, 2014
1 parent 6f2146f commit 578c64d
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions lib/datastore/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -195,9 +195,10 @@ Transaction.prototype.saveAll = function(keys, objs, callback) {
if (err || !resp) {
return callback(err);
}
var keys = [];
resp.mutationResult.insertAutoIdKeys && resp.mutationResult.insertAutoIdKeys.forEach(function(item) {
keys.push(entity.keyFromKeyProto(item));
resp.mutationResult.insertAutoIdKeys = resp.mutationResult.insertAutoIdKeys || [];
var i = 0;
resp.mutationResult.insertAutoIdKeys.forEach(function(item) {
keys[insertIndexes[i++]] = entity.keyFromKeyProto(item);
});
callback(null, keys);
});
Expand Down

0 comments on commit 578c64d

Please sign in to comment.