diff --git a/packages/datastore/src/index.js b/packages/datastore/src/index.js index a1bcb43dd47..dfda7d80e3c 100644 --- a/packages/datastore/src/index.js +++ b/packages/datastore/src/index.js @@ -440,8 +440,8 @@ Datastore.NO_MORE_RESULTS = 'NO_MORE_RESULTS'; * var query = datastore.createQuery('Company'); */ Datastore.prototype.createQuery = function(namespace, kind) { - if (arguments.length === 1) { - kind = arrify(namespace); + if (arguments.length < 2) { + kind = namespace; namespace = this.namespace; } diff --git a/packages/datastore/test/index.js b/packages/datastore/test/index.js index 64e62f2d7dc..6ddbbfc703e 100644 --- a/packages/datastore/test/index.js +++ b/packages/datastore/test/index.js @@ -284,6 +284,14 @@ describe('Datastore', function() { assert.strictEqual(query.calledWith_[1], datastore.namespace); assert.deepEqual(query.calledWith_[2], kind); }); + + it('should include the default namespace in a kindless query', function() { + var query = datastore.createQuery(); + + assert.strictEqual(query.calledWith_[0], datastore); + assert.strictEqual(query.calledWith_[1], datastore.namespace); + assert.deepEqual(query.calledWith_[2], []); + }); }); describe('key', function() {