Skip to content

query.limit() is not working if the limit is set to >600 #1634

@ajithreddy

Description

@ajithreddy

Look at the below code

var datastore = require('@google-cloud/datastore');
var gcloudDataset = datastore({
    projectId: <someId>,
    keyFilename: <somefile>
});

function test() {
  var offset = 0;
  var limit = 601;
  var query = gcloudDataset.createQuery('TableName')
    .limit(limit)
    .offset(offset);

  var initTime = new Date().getTime();
  console.log("Pulling  offset: " + offset + ", limit: " + limit);
  gcloudDataset.runQuery(query, function (err, entities, nextQuery) {
    console.log("Pulled " + entities.length + " items, start: " + offset + ", limit: " + limit
      + ", Time taken: " + ((new Date().getTime() - initTime) / 1000).toFixed(0) + "s");
  });
};

When the limit is set to 600 or less, it returns me the 'limited' results. But when the limit is set to >=601, it returns all the results. I know it is an odd issue but I am not able to figure out what is the problem with my code. Am I using the api correctly ?

Environment details

  • OS: os x el capitan (10.11.6)
  • Node.js version: v4.5.0
  • npm version: 3.10.8
  • google-cloud-node version: 0.4.0

Thanks!

Metadata

Metadata

Labels

api: datastoreIssues related to the Datastore API.type: bugError or flaw in code with unintended results or allowing sub-optimal usage patterns.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions