我正在尝试使用游标来访问大型结果集,但似乎无法让它们工作(即无限滚动)。到目前为止,这是我的代码,其中cursor是一个全局存储的字符串:
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 );
}
});
当我检查网络流量时,我发现光标永远不会通过。有人能指出我的解决方案吗?
答案 0 :(得分:2)
查看来源(https://github.com/usergrid/usergrid/blob/master/sdks/html5-javascript/usergrid.js ln 2004):
this._cursor = options.cursor
所以看来你需要将游标设置为选项的属性,而不是qs的子属性:
var options = {
type: "users",
client: myClient,
qs:{
ql:"location within " + distance + " of " + geo.lat + ", " + geo.lon,
limit:25
},
cursor:cursor
}