Closed
Description
Using Graphql Query 'after' option with a cursor of position N, yields a result-set starting from position N+2 upwards, skipping the document right after the cursor that should have been included (N+1).
Using the latest graphql and mongodb starters
implementation 'org.springframework.boot:spring-boot-starter-data-mongodb'
implementation 'org.springframework.boot:spring-boot-starter-graphql'
Using graphql @QueryMapping annotation and ScrollSubrange on a controller
@QueryMapping
public Window<Customer> customers(@Argument String storeNumber, ScrollSubrange subrange) {
//...
}
and a query:
query MyQuery {
customers(storeNumber: "123", after: "T18x") {
edges {
cursor
node {
name
storeNumber
}
}
}
}
where 'T18x' is the cursor of the first document, results in subrange.position() of 2.
Using that position in a mongodb Query:
var query = Query.query(criteria)
.with(scrollPosition);
would actually skip 2 documents, and not start from document of position 2 (thus not inclusive).
Seems to be related to #916
A project reproducing the bug can be found here: graphql-bug