diff --git a/lib/datastore/entity.js b/lib/datastore/entity.js index aa22300688c..d07ee077bb5 100644 --- a/lib/datastore/entity.js +++ b/lib/datastore/entity.js @@ -76,7 +76,7 @@ module.exports.keyFromKeyProto = keyFromKeyProto; var keyToKeyProto = function(datasetId, key) { if (key.length < 2) { - throw new Error("A key should contain at least a kind and an idenfier.") + throw new Error("A key should contain at least a kind and an identifier.") } var namespace = null, start = 0; if (key.length % 2 == 1) { diff --git a/lib/datastore/index.js b/lib/datastore/index.js index c3c7cea500e..53ebc0acb1c 100644 --- a/lib/datastore/index.js +++ b/lib/datastore/index.js @@ -172,7 +172,7 @@ Transaction.prototype.saveAll = function(keys, objs, callback) { var req = { mode: MODE_NON_TRANSACTIONAL, mutation: { - update: [], + upsert: [], insertAutoId: [] } }; @@ -184,7 +184,7 @@ Transaction.prototype.saveAll = function(keys, objs, callback) { var e = entity.entityToEntityProto(objs[i]); e.key = entity.keyToKeyProto(this.id, keys[i]); if (entity.isKeyComplete(keys[i])) { - req.mutation.update.push(e); + req.mutation.upsert.push(e); } else { insertIndexes.push(i); req.mutation.insertAutoId.push(e); diff --git a/test/datastore.js b/test/datastore.js index 2d1132a869e..444b71d9ef4 100644 --- a/test/datastore.js +++ b/test/datastore.js @@ -163,8 +163,8 @@ describe('Dataset', function() { var ds = new datastore.Dataset({ projectId: 'test' }); ds.transaction.makeReq = function(method, proto, callback) { assert.equal(method, 'commit'); - assert.equal(proto.mutation.update.length, 2); - assert.equal(proto.mutation.update[0].properties.k.stringValue, 'v'); + assert.equal(proto.mutation.upsert.length, 2); + assert.equal(proto.mutation.upsert[0].properties.k.stringValue, 'v'); callback(); }; ds.saveAll([