Is there any way to fetch documents with pagination using the driver's built-in mapper? The findAll()
method accepts pageState
as an option but does not return it to use it in next calls.
const result = await this.repository.findAll({ limit: 1 }, { fetchSize: 1 });
console.log(JSON.stringify(result));
returns this JSON:
{
"_rs": {
"info": {
"queriedHost": "127.0.0.1:9042",
"triedHosts": {
"127.0.0.1:9042": null
},
"speculativeExecutions": 0,
"achievedConsistency": 10,
"isSchemaInAgreement": true
},
"rows": [],
"rowLength": 0,
"columns": [
{
"name": "namespace_id",
"type": {
"code": 13,
"type": null
}
},
{
"name": "archived_at",
"type": {
"code": 15,
"type": null
}
},
{
"name": "channel_id",
"type": {
"code": 13,
"type": null
}
},
{
"name": "created_at",
"type": {
"code": 11,
"type": null
}
},
{
"name": "department_id",
"type": {
"code": 13,
"type": null
}
},
{
"name": "id",
"type": {
"code": 13,
"type": null
}
},
{
"name": "identifier_type",
"type": {
"code": 13,
"type": null
}
},
{
"name": "identifier_value",
"type": {
"code": 13,
"type": null
}
},
{
"name": "last_assignee_id",
"type": {
"code": 9,
"type": null
}
}
],
"pageState": null
},
"_info": {
"keyspace": "omnichannel",
"tables": [
{
"name": "ticket_by_archive_time",
"isView": false
},
{
"name": "ticket_by_id",
"isView": false
},
{
"name": "ticket_by_identifier",
"isView": false
}
],
"_mappings": {},
"_columns": {},
"_documentProperties": {}
},
"_isEmptyLwt": false,
"length": 0,
"pageState": null
}
The problem was passing limit
option, removing it and using only fetchSize
fixed the issue.