GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — How are query start cursorTokens used? · Issue #1208 · googleapis/google-cloud-node

How are query start cursorTokens used? #1208

New issue
Copy link
New issue
Copy link
Closed
Closed
How are query start cursorTokens used?#1208
Copy link
Assignees
stephenplusplus
Labels
api: datastoreIssues related to the Datastore API.

Description

@mcfarljw
mcfarljw
opened on Apr 6, 2016
Issue body actions

My application is using express and I'm having some troubles getting the latest ~0.30.0 releases to return a cursor value I can pass back to the client for usage. If I recall correctly the previous releases were using a base64 string. What kind of cursorToken should I be passing a start query now?

https://googlecloudplatform.github.io/gcloud-node/#/docs/v0.30.2/datastore/query?method=start

datastore.runQuery(
    datastore.createQuery('User').start(???).limit(1),
    function(error, entities, cursor) {
        // cursor used to return base64 startVal
    }
);

Maybe I should manually convert it myself now?

new Buffer(cursor.startVal).toString('base64')

Activity

  1. mcfarljw commented on Apr 6, 2016

    @mcfarljw
    mcfarljw
    on Apr 6, 2016
    ContributorAuthor
    More actions

    I've just spent a bit of time looking into the issue and did get it working. Here is what I came up with:

    var cursorToken = req.cursorToken ? new Buffer(req.cursorToken, 'base64') : null;
    datastore.runQuery(
        datastore.createQuery('User').start(cursorToken).limit(1),
        function(error, entities, nextQuery) {
            var result = {};
            result.cursorToken = new Buffer(nextQuery.startVal).toString('base64');
            res.status(200).json(result);
    );
    

    It might make things a bit more straightforward and easier to work with if the start method would accept both base64 and buffer parameters. It might also be convenient for the nextQuery to include a base64 version called endCursorToken and startCursorToken so that it matches up a bit more with the documentation.

  2. stephenplusplus commented on Apr 6, 2016

    @stephenplusplus
    stephenplusplus
    on Apr 6, 2016
    Contributor
    More actions

    I think we should just go back to only accepting base64 strings and skip buffers altogether. Any interest in putting a PR together?

  3. stephenplusplus
    added
    help wanted
    api: datastoreIssues related to the Datastore API.
    on Apr 6, 2016
  4. mcfarljw commented on Apr 6, 2016

    @mcfarljw
    mcfarljw
    on Apr 6, 2016
    ContributorAuthor
    More actions

    I'll take a shot at making a PR for this and see what happens.

  5. stephenplusplus commented on Apr 6, 2016

    @stephenplusplus
    stephenplusplus
    on Apr 6, 2016
    Contributor
    More actions

    Thanks! Feel free to send it in even if it's not perfect. I can always help with the grunt work (code style, tests, etc).

  6. stephenplusplus commented on Apr 7, 2016

    @stephenplusplus
    stephenplusplus
    on Apr 7, 2016
    Contributor
    More actions

    Fixed via a80ff9b

  7. stephenplusplus
    closed this as completedon Apr 7, 2016
  8. JustinBeckwith
    assigned
    stephenplusplus
    on Feb 1, 2021
  9. sofisl
    added a commit that references this issue on Feb 3, 2026

    chore(main): release 6.2.1 (#1208)

    e69775b
  10. sofisl
    added 2 commits that reference this issue on Feb 25, 2026

    feat: allow setting timeouts on uploads (#1208)

    edf9085

    fix: handle potential errors when creating stream (#1208)

    2be06a4
  11. GautamSharda
    added a commit that references this issue on Mar 5, 2026

    chore(deps): update dependency gts to v3 (#1208)

    3f4652e
  12. thiyaguk09
    added a commit that references this issue on Mar 18, 2026

    feat: allow setting timeouts on uploads (googleapis#1208)

    f60d2ce
  13. GautamSharda
    added 2 commits that reference this issue on Mar 23, 2026

    build: have Kokoro grab service account credentials from secret that …

    8a8e7a8

    build: have Kokoro grab service account credentials from secret that …

    ee32092
  14. shivanee-p
    added a commit that references this issue on Mar 27, 2026

    build: have Kokoro grab service account credentials from secret that …

    639b7cc
  15. thiyaguk09
    added a commit that references this issue on May 5, 2026

    build: have Kokoro grab service account credentials from secret that …

    646c321
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

  • @stephenplusplus
    stephenplusplus

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

    You are visitor 01402775 — GeezerVison does not store the pages you look up.
    Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.