Like @Jay-Fauna , I cannot reproduce your problem.
The pagination tutorial in the documentation includes establishing a collection called Letters
which contains one document per alphabet letter, with a custom id for each starting with 101
: Index tutorials | Fauna Documentation
I get the expected behaviour:
> Paginate(
Documents(Collection("Letters")),
{ size: 2, after: Ref(Collection("Letters"), "125") }
)
{
before: [ Ref(Collection("Letters"), "125") ],
data: [
Ref(Collection("Letters"), "125"),
Ref(Collection("Letters"), "126")
]
}
Note that the pagination options object in your example always contains after
and before
. You should include one or the other, but not both, in your pagination queries. If you had, you would receive an error.
> Paginate(
Documents(Collection("Letters")),
{
size: 2,
after: Ref(Collection("Letters"), "125"),
before: Ref(Collection("Letters"), "125")
}
)
Error: invalid expression
{
errors: [
{
position: [],
code: 'invalid expression',
description: 'No form/function found, or invalid argument keys: { paginate, size, after, before }.'
}
]
}
Since you’re not getting an error, there might be a problem in the logic that picks the references to use for before
and after
.
Can you try creating the pagination options object based on whether the after
or before
parameters are defined?
Also, note that it should be an error to redeclare function parameters as constants.