Pagination 使用slice或limit&;带更改跳过()
如何使用changes()在数据库中进行分页 这些选项都不起作用:Pagination 使用slice或limit&;带更改跳过(),pagination,rethinkdb,Pagination,Rethinkdb,如何使用changes()在数据库中进行分页 这些选项都不起作用: r.db('bustest').table('client').orderBy({index: r.desc("id")}).slice(3, 3).changes() r.db('bustest').table('client').orderBy({index: r.desc("id")}).skip(3).limit(3).changes() 只有它起作用: r.db('bustest').table('client')
r.db('bustest').table('client').orderBy({index: r.desc("id")}).slice(3, 3).changes()
r.db('bustest').table('client').orderBy({index: r.desc("id")}).skip(3).limit(3).changes()
只有它起作用:
r.db('bustest').table('client').orderBy({index: r.desc("id")}).limit(3).changes()
更新:
例如,更改后跳过()
返回:
{
"state": "ready"
},
{
"new_val": {
"first_name": "Gruzin" ,
"id": "e9580339-b908-4349-a208-c3d1e25bf7ba" ,
"last_name": "Bagal"
}
},
{
"new_val": {
"first_name": "e31db5422cd74040" ,
"id": "efadedd0-56f2-498f-ad04-5191e2be1244" ,
"last_name": "27d6b3a140235275"
}
},
{
"new_val": {
"first_name": "2ba4a9d0e3616865" ,
"id": "f5c7f3b7-23d2-4661-a5b7-91b977635556" ,
"last_name": "b7f4df90a27bb05b"
}
},
{
"state": "initializing"
}
{
"state": "ready"
},
{
"new_val": {
"first_name": "Gruzin" ,
"id": "e9580339-b908-4349-a208-c3d1e25bf7ba" ,
"last_name": "Bagal"
}
}
使用skip:
r.db('bustest').table('client').orderBy({index: r.desc("id")}).limit(3).changes({squash: 0.05, includeInitial: true, includeStates: true}).skip(3)
返回:
{
"state": "ready"
},
{
"new_val": {
"first_name": "Gruzin" ,
"id": "e9580339-b908-4349-a208-c3d1e25bf7ba" ,
"last_name": "Bagal"
}
},
{
"new_val": {
"first_name": "e31db5422cd74040" ,
"id": "efadedd0-56f2-498f-ad04-5191e2be1244" ,
"last_name": "27d6b3a140235275"
}
},
{
"new_val": {
"first_name": "2ba4a9d0e3616865" ,
"id": "f5c7f3b7-23d2-4661-a5b7-91b977635556" ,
"last_name": "b7f4df90a27bb05b"
}
},
{
"state": "initializing"
}
{
"state": "ready"
},
{
"new_val": {
"first_name": "Gruzin" ,
"id": "e9580339-b908-4349-a208-c3d1e25bf7ba" ,
"last_name": "Bagal"
}
}
更改后跳过()不起作用。但是使用changes()分页对我的项目来说是非常重要的一部分。这就是我在 不能将它们与
切片跳过一起使用。仅限orderBy
,后跟limit
。只有更改之前的orderBy
也有效
要对更改本身进行分页(表示通过更改提要返回数据),在更改()
之后,可以调用跳过,只需自己迭代返回光标即可。但是,如果在更改
之后使用限制
或切片
,则changefeeds只返回该更改量,并关闭changefeed