question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Server side pagination with search

See original GitHub issue

I have a webpage where I’m listing some data from the database. There’s also a button that the users can press to load more stuff from the database. I’m trying to limit my query so not all the data get’s loaded to the client at once. The users can also search in the data.

My Query:

export default createQuery({
  movies: {
    $filter({filters, options, params}) {
      filters.title = { $regex: new RegExp(`.*${params.title}.*`, "i") };
    },
    $paginate: true,
    title: 1
  }
}); 

Client:

export default withQuery((props) => {
  return query.clone({
    title: props.title,
    limit: props.limit
  });
}, {reactive: true})(Movies)

My problem is that the search only occurs in the limited documents and not in every document in the movies collection. Is there any way to fix this?

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:18 (10 by maintainers)

github_iconTop GitHub Comments

1reaction
bhunjadicommented, Sep 21, 2018

@Twisterking @theodorDiaconu

I think I had something similar for an issue and believe I solved it by using scoped queries. It is an issue of pub-sub, but it seems to me the problem can be overcome with scoped queries.

I tried that idea in my own fork of grapher and it worked as expected. I used library from mitar, meteor-subscription-scope, and made some adaptation for grapher.

Example of usage:

const query = createQuery('...', {
    $filters: {...},
    ...,
}, {
    scoped: true,
});

Notice the scoped option for a query.

@theodorDiaconu If you are interested, I can make PR. This is the commit where I implemented that feature.

1reaction
Twisterkingcommented, Jun 18, 2018

weeeeellll nevermind - I got it to work! 👍 One of those cases - should have properly read the docs! 😆

Read more comments on GitHub >

github_iconTop Results From Across the Web

Server side pagination with Individual column searching
Hello all I am binding data using server side code which is working as expected, on top of it I am trying to...
Read more >
React Table Pagination (Server side) with Search - BezKoder
In this tutorial, I will show you how to make React Table Pagination (Server side) with Search in a React Hooks Application using ......
Read more >
Angular server side pagination and filtering - Level Up Coding
In this article, we'll learn how to use RxJS to implement server side pagination and filtering for a datatable in an Angular application....
Read more >
Angular Material Serverside Pagination And Rxjs Search
angular-material-serverside-pagination-and-rxj. s-search. [Edit on StackBlitz ⚡️](https://stackblitz. com/edit/.
Read more >
Client Side vs Server Side Pagination: How to Choose the ...
Client Side Pagination means that when a query is made, the server returns to the client all the data in one big chunk....
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found