From 53037025442152457701d871249e327be8d26bbe Mon Sep 17 00:00:00 2001 From: Stephen Sawchuk Date: Tue, 30 Jun 2015 12:46:38 -0400 Subject: [PATCH] docs: datastore: document keys-only query --- lib/datastore/request.js | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/lib/datastore/request.js b/lib/datastore/request.js index e0260b5d8bf..aa0ce984405 100644 --- a/lib/datastore/request.js +++ b/lib/datastore/request.js @@ -503,6 +503,17 @@ DatastoreRequest.prototype.delete = function(keys, callback) { * //- * transaction.runQuery(query) * .on('data', function (entity) {}); + * + * //- + * // A keys-only query returns just the keys of the result entities instead of + * // the entities themselves, at lower latency and cost. + * //- + * var keysOnlyQuery = dataset.createQuery('Lion').select('__key__'); + * + * transaction.runQuery(query, function(err, entities, endCursor, callback) { + * // entities[].key = Key object + * // entities[].data = Empty object + * }); */ DatastoreRequest.prototype.runQuery = function(q, callback) { var that = this;