From 9838ee177491f5ce33e0bf80cbe807bb63751a24 Mon Sep 17 00:00:00 2001 From: Stephen Sawchuk Date: Mon, 30 Nov 2015 12:54:02 -0500 Subject: [PATCH] datastore: docs: show example of updating an entity --- lib/datastore/request.js | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/lib/datastore/request.js b/lib/datastore/request.js index 5c770659fae..2791a91f2fb 100644 --- a/lib/datastore/request.js +++ b/lib/datastore/request.js @@ -151,6 +151,19 @@ function DatastoreRequest() {} * .on('end', function() { * // All entities retrieved. * }); + * + * //- + * // Here's how you would update the value of an entity with the help of the + * // `save` method. + * //- + * dataset.get(key, function(err, entity) { + * if (err) { + * // Error handling omitted. + * } + * + * entity.data.newValue = true; + * dataset.save(entity, function(err) {}); + * }); */ DatastoreRequest.prototype.get = function(keys, callback) { if (is.fn(callback)) {