Skip to content

Commit c228014

Browse files
committed
Merge pull request #603 from ryanseys/no-multi-kinds
Do not document queries as supporting multiple kinds
2 parents bf50e25 + 0188377 commit c228014

File tree

3 files changed

+9
-22
lines changed

3 files changed

+9
-22
lines changed

lib/datastore/dataset.js

+5-5
Original file line numberDiff line numberDiff line change
@@ -185,7 +185,7 @@ Dataset.prototype.key = function(options) {
185185
};
186186

187187
/**
188-
* Create a query from the current dataset to query the specified kinds, scoped
188+
* Create a query from the current dataset to query the specified kind, scoped
189189
* to the namespace provided at the initialization of the dataset.
190190
*
191191
* *[Reference](http://goo.gl/Cag0r6).*
@@ -194,16 +194,16 @@ Dataset.prototype.key = function(options) {
194194
* @see {module:datastore/query}
195195
*
196196
* @param {string=} namespace - Optional namespace.
197-
* @param {string|array} kinds - Kinds to query.
197+
* @param {string} kind - Kind to query.
198198
* @return {module:datastore/query}
199199
*/
200-
Dataset.prototype.createQuery = function(namespace, kinds) {
200+
Dataset.prototype.createQuery = function(namespace, kind) {
201201
if (arguments.length === 1) {
202-
kinds = util.arrayize(namespace);
202+
kind = util.arrayize(namespace);
203203
namespace = this.namespace;
204204
}
205205

206-
return new Query(namespace, util.arrayize(kinds));
206+
return new Query(namespace, util.arrayize(kind));
207207
};
208208

209209
/**

lib/datastore/query.js

+4-4
Original file line numberDiff line numberDiff line change
@@ -41,18 +41,18 @@ var util = require('../common/util.js');
4141
* @alias module:datastore/query
4242
*
4343
* @param {string=} namespace - Namespace to query entities from.
44-
* @param {string[]} kinds - Kinds to query.
44+
* @param {string} kind - Kind to query.
4545
*
4646
* @example
4747
* // If your dataset was scoped to a namespace at initialization, your query
4848
* // will likewise be scoped to that namespace.
49-
* dataset.createQuery(['Lion', 'Chimp']);
49+
* dataset.createQuery('Lion');
5050
*
5151
* // However, you may override the namespace per query.
52-
* dataset.createQuery('AnimalNamespace', ['Lion', 'Chimp']);
52+
* dataset.createQuery('AnimalNamespace', 'Lion');
5353
*
5454
* // You may also remove the namespace altogether.
55-
* dataset.createQuery(null, ['Lion', 'Chimp']);
55+
* dataset.createQuery(null, 'Lion');
5656
*/
5757
function Query(namespace, kinds) {
5858
if (!kinds) {

test/datastore/query.js

-13
Original file line numberDiff line numberDiff line change
@@ -43,19 +43,6 @@ describe('Query', function() {
4343
assert.equal(query.namespace, 'ns');
4444
});
4545

46-
it('should support querying multiple kinds', function() {
47-
var query = new Query(['kind1', 'kind2']);
48-
var queryWithNamespace = new Query('ns', ['kind1', 'kind2']);
49-
50-
assert.strictEqual(query.namespace, null);
51-
assert.equal(query.kinds[0], 'kind1');
52-
assert.equal(query.kinds[1], 'kind2');
53-
54-
assert.equal(queryWithNamespace.namespace, 'ns');
55-
assert.equal(queryWithNamespace.kinds[0], 'kind1');
56-
assert.equal(queryWithNamespace.kinds[1], 'kind2');
57-
});
58-
5946
it('should support field selection by field name', function() {
6047
var query = new Query(['kind1'])
6148
.select(['name', 'title']);

0 commit comments

Comments
 (0)