How to paginate a union in graphql?


#1

Say you have three mongo collections, three graphql types respectively, and they come together in a graphql endpoint that uses a union to return an array [Type1, Type2, Type3].

Does anyone have experience they could share paginating something like this?


#2

For cursor based pagination, I ended up keeping track of the cursor for each type and sending those cursors to the resolver as parameters.


#3

That’s a nice solution