I created an infinite scroll pagination in my app using parameter passed sub/pub method and also use limit and skip inside my publications. but when it taking more than 1000 records the app is getting slow and when it comes to 31000 records the app crashing the browser(as per the query, limit is 10 and skip is 0 but the date range will calculate this 31000 records and when i checked my websockets calls i found that this skip and limit not working it takes all records). the total count of the collection
here is my pub/sub code
Meteor.publish(‘posts’, function (fromDate,toDate,limit) {
The publication will keep all the records sent to the client in minimongo. So even you are displaying less with limits, minimongo is still keeping all records in the client
In these cases, we use methods instead of publications
@rjdavid thank you but how to implement the method without subscription, the data access from server to cleint is possible through subscribe/publication only.
What is limiting you to only use subscription and not a method? In Meteor, you have the option to use either depending on your use case
In our case, everytime the trigger is hit near the bottom of the page, the next set of documents are queried through a method and then appended on the existing records in the client.
@rjdavid currently i am using both, method and subscription, first subscribe the data with filter a client id and then using a method with other search parameters , the database is very large and performance is very poor, thats why i changed the publication to pass more parameters and subscribe a minimum amount of data on initial load and load more when triggering the load more button
@rjdavid@ignl Thanks, i found the reason, the pub/sub method is crashing the browser, when i tried to navigate to other page, it takes too much time for unsubscribe the data. anyway i planned to change the pub/sub method and use an api application for handle this huge data.