MoreScratch
MoreScratch

Reputation: 3083

Apigee BaaS and cursors

I am trying to use cursors to access large result sets but can't seem to get them to work (i.e. endless scroll). Here is my code thus far where cursor is a string that store globally:

var options = {
    type: "users",
    client: myClient,
    qs:{ 
        ql:"location within " + distance + " of " + geo.lat + ", " + geo.lon,
        limit:25,
        cursor:cursor
    }

},        

var entities = new Apigee.Collection( options );

entities.fetch( function ( error, response ) {            
    if (error) {
        //error
    } else {              
        //success
        populateEntityList( response );
    }
});

When I inspect the network traffic I see that the cursor is never passed. Can someone point me to a solution?

Upvotes: 2

Views: 130

Answers (1)

amuramoto
amuramoto

Reputation: 2848

Looking at the source (https://github.com/usergrid/usergrid/blob/master/sdks/html5-javascript/usergrid.js ln 2004):

this._cursor = options.cursor

So it appears you need to set cursor as a property of options, not a subproperty of qs:

var options = {
type: "users",
client: myClient,
qs:{ 
    ql:"location within " + distance + " of " + geo.lat + ", " + geo.lon,
    limit:25        
},
cursor:cursor
}

Upvotes: 2

Related Questions