Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Do not document queries as supporting multiple kinds #603

Merged
merged 1 commit into from
May 19, 2015
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions lib/datastore/dataset.js
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,7 @@ Dataset.prototype.key = function(options) {
};

/**
* Create a query from the current dataset to query the specified kinds, scoped
* Create a query from the current dataset to query the specified kind, scoped
* to the namespace provided at the initialization of the dataset.
*
* *[Reference](http://goo.gl/Cag0r6).*
Expand All @@ -194,16 +194,16 @@ Dataset.prototype.key = function(options) {
* @see {module:datastore/query}
*
* @param {string=} namespace - Optional namespace.
* @param {string|array} kinds - Kinds to query.
* @param {string} kind - Kind to query.
* @return {module:datastore/query}
*/
Dataset.prototype.createQuery = function(namespace, kinds) {
Dataset.prototype.createQuery = function(namespace, kind) {
if (arguments.length === 1) {
kinds = util.arrayize(namespace);
kind = util.arrayize(namespace);
namespace = this.namespace;
}

return new Query(namespace, util.arrayize(kinds));
return new Query(namespace, util.arrayize(kind));
};

/**
Expand Down
8 changes: 4 additions & 4 deletions lib/datastore/query.js
Original file line number Diff line number Diff line change
Expand Up @@ -41,18 +41,18 @@ var util = require('../common/util.js');
* @alias module:datastore/query
*
* @param {string=} namespace - Namespace to query entities from.
* @param {string[]} kinds - Kinds to query.
* @param {string} kind - Kind to query.
*
* @example
* // If your dataset was scoped to a namespace at initialization, your query
* // will likewise be scoped to that namespace.
* dataset.createQuery(['Lion', 'Chimp']);
* dataset.createQuery('Lion');
*
* // However, you may override the namespace per query.
* dataset.createQuery('AnimalNamespace', ['Lion', 'Chimp']);
* dataset.createQuery('AnimalNamespace', 'Lion');
*
* // You may also remove the namespace altogether.
* dataset.createQuery(null, ['Lion', 'Chimp']);
* dataset.createQuery(null, 'Lion');
*/
function Query(namespace, kinds) {
if (!kinds) {
Expand Down
13 changes: 0 additions & 13 deletions test/datastore/query.js
Original file line number Diff line number Diff line change
Expand Up @@ -43,19 +43,6 @@ describe('Query', function() {
assert.equal(query.namespace, 'ns');
});

it('should support querying multiple kinds', function() {
var query = new Query(['kind1', 'kind2']);
var queryWithNamespace = new Query('ns', ['kind1', 'kind2']);

assert.strictEqual(query.namespace, null);
assert.equal(query.kinds[0], 'kind1');
assert.equal(query.kinds[1], 'kind2');

assert.equal(queryWithNamespace.namespace, 'ns');
assert.equal(queryWithNamespace.kinds[0], 'kind1');
assert.equal(queryWithNamespace.kinds[1], 'kind2');
});

it('should support field selection by field name', function() {
var query = new Query(['kind1'])
.select(['name', 'title']);
Expand Down