I have 42 items which should be returned:
/*
query originally looks like this:
datastore.createQuery('Messages').filter('sender',username).limit(10).autoPaginate(false);
*/
var query = nextQuery_var_passed_in_from_client;
getmessages(query,function(err,data){
if(err){
console.log('error: ' + err);
}
});
});
//callback function
function getrecmessages(query,callback){
datastore.runQuery(query, function(err, entities, nextQuery, apiResponse){
if (err) {
return(callback(err));
}
if (nextQuery) {
console.log('nextQuery = ' + JSON.stringify(nextQuery) );
if(entities){
console.log(entities);
}else{
console.log('no entities');
}
} else {
// No more results exist.
console.log('NextQuery IS NULL' );
}
});
}
The query first gets the first 10 items, then the next 10, then the next 10, then the remaining 2(42 items). The problem then is when I make the last query to get the last 2 items it returns a nextQuery. As a result it looks as if there is more items even though there are none. I have gone over my code and I can't see anything that is causing this so I am thinking it has something to do with gcloud. I am expecting that when the last query is made no nextQuery should be returned by the datastore. Is this correct?
I am using gcd-rpc emulator and gcloud-node 0.31.0.
I have 42 items which should be returned:
The query first gets the first 10 items, then the next 10, then the next 10, then the remaining 2(42 items). The problem then is when I make the last query to get the last 2 items it returns a nextQuery. As a result it looks as if there is more items even though there are none. I have gone over my code and I can't see anything that is causing this so I am thinking it has something to do with gcloud. I am expecting that when the last query is made no nextQuery should be returned by the datastore. Is this correct?
I am using gcd-rpc emulator and gcloud-node 0.31.0.