Skip to content

Always MORE_RESULTS_AFTER_LIMIT returned #1318

@susanlinsfu

Description

@susanlinsfu

I of course might be missing something, but I have 10 entities in my KIND. I run the following code:

var NUM_RESULTS_PER_PAGE = 5;

app.get('/getusers', function(req, res) {
  var query = datastore.createQuery('users')
    .limit(NUM_RESULTS_PER_PAGE);

  if (req.query.nextPageCursor) {
    query.start(req.query.nextPageCursor);
  }

  datastore.runQuery(query, function(err, entities, info) {
    if (err) {
      // Error handling omitted...
      return;
    }

    // Respond to the front end with the contacts and the cursoring token
    // from the query we just ran.
    var frontEndResponse = {
      contacts: entities
    };

    // Check if  more results may exist.
    if (info.moreResults !== gcloud.datastore.NO_MORE_RESULTS) {
      frontEndResponse.nextPageCursor = info.endCursor;
    }

    res.render('contacts', frontEndResponse);
  });
});

I run the code, it gets the first 5 entities (1-5) and it returns MORE_RESULTS_AFTER_LIMIT. I then take the nextPageCursor and query again, it now gets the next 5 entities (6-10) and it returns MORE_RESULTS_AFTER_LIMIT. There are no more entities though, and I take the cursor from this response it now returns no entities since there are no more, but it still returns MORE_RESULTS_AFTER_LIMIT, but there are no more? I would expect to receive NO_MORE_RESULTS?

Metadata

Metadata

Labels

api: datastoreIssues related to the Datastore API.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions