Closed daisycrego closed 3 years ago
paginated queries Search page’s queryState includes page # and page size. At the server controllers for listing events and leads data, use the page to derive a portion of the data to send back. See about paginated queries from mongo- can we pass page /offset/etc in the find calls? Do we need to retrieve all data and then slice it up (much slower)?
The quickest solution to implementing pagination is something like this:
db.history.find({ customerId: 7000000 })
.sort({ date: 1 })
.skip(0)
.limit(1000)
But we might run into problems with latency for the larger pages: https://www.mongodb.com/blog/post/paging-with-the-bucket-pattern--part-1
Implemented paginated queries. Seems to work for more of the cases, much faster. May still have the higher page number issue described in the link, but for now ok.
Previous data sizes resulted in latency with search loads --> current larger data sizes are leading to outright failed searches. Heroku logs show that searches which will return all data rows exceed JS heap memory: