Hi!
Let’s say I have two collections. Parent and Child, and that I want to display Parents in a paginated view.
I’m following Meteor’s recommended pattern of pagination by including some sort parameter to guarantee a repeatable sequence of records. I have a Skip and Limit reactiveVars of 20 each. That way anytime the users clicks next or clicks on a numbered page, the query will adjust accordingly and just publish the 20 parent records (and their children) that I need.
My issue is that I need to sort by a Child record field.
Is there any way for me to add Child.Number to each top-level parent document in the publication itself (So it’s just on the cursor and not actually in the collection)? Re-sorting by Child.Number on the client side only guarantees that each page will be sorted correctly, but not the sequence of pages.
I can add Child.Number to each Parent document. But I’d rather not add a new field if I don’t have to and perform a migration.
Any insights?