diff --git a/datastore/README.md b/datastore/README.md index d3475602db..f1cbd55934 100644 --- a/datastore/README.md +++ b/datastore/README.md @@ -47,7 +47,8 @@ Commands: delete Deletes a task. Options: - --help Show help [boolean] + --version Show version number [boolean] + --help Show help [boolean] Examples: node tasks.js new "Buy milk" Adds a task with description "Buy milk". diff --git a/datastore/concepts.js b/datastore/concepts.js index 277b93e581..453457b6b7 100644 --- a/datastore/concepts.js +++ b/datastore/concepts.js @@ -1033,9 +1033,25 @@ class Query extends TestHelper { testEventualConsistentQuery (t) { t.plan(0); + const datastoreMock = datastore; + datastore = this.datastore; // [START eventual_consistent_query] - // Read consistency cannot be specified in google-cloud-node. + const ancestorKey = datastore.key(['TaskList', 'default']); + const query = datastore.createQuery('Task') + .hasAncestor(ancestorKey); + + query.run({ consistency: 'eventual' }); // [END eventual_consistent_query] + return query.run({ consistency: 'eventual' }) + .then((results) => { + datastore = datastoreMock; + const entities = results[0]; + return entities; + }) + .catch((err) => { + datastore = datastoreMock; + return Promise.reject(err); + }); } } diff --git a/datastore/package.json b/datastore/package.json index 42673c3698..ae79053edd 100644 --- a/datastore/package.json +++ b/datastore/package.json @@ -9,7 +9,7 @@ "url": "https://github.com/GoogleCloudPlatform/nodejs-docs-samples.git" }, "engines": { - "node": ">=4.3.2" + "node": ">=4" }, "scripts": { "lint": "samples lint", @@ -18,13 +18,13 @@ }, "dependencies": { "@google-cloud/datastore": "1.1.0", - "yargs": "8.0.2" + "yargs": "9.0.1" }, "devDependencies": { "@google-cloud/nodejs-repo-tools": "1.4.17", - "ava": "0.21.0", + "ava": "0.22.0", "proxyquire": "1.8.0", - "sinon": "3.2.0" + "sinon": "3.3.0" }, "cloud-repo-tools": { "requiresKeyFile": true,