Stream MongoDB data to client

Viewed 34

I am having trouble scaling my react application as our database collections increase in size. We are a physical products marketplace and the way we currently display our listings is by loading the whole 'listings' collection at once on redux through 1 http request and state update. That is highly inefficient as you need to load the whole 'listings' collection before doing anything on the website. Once it is loaded it is super fast at rendering any page since the whole DB data is stored in redux. Though that takes more than 30s at times!

My question: is there a way to open an HTTP stream or similar with MongoDB atlas so that I can render listings dynamically by updating the redux state as they come through from the server?

Is there any other way to achieve faster load speed by still leveraging react-redux?

What's the best practice with data heavy SPAs?

We have an express, node js back end with react front end. Using MongoDB for storage. React-redux to share states between components.

1 Answers

You should use pagination to fetch and display products.

Related