D
D
Denis11112019-03-11 00:51:33
MongoDB
Denis1111, 2019-03-11 00:51:33

How to load articles in Node JS?

There are 12-18 articles, clicking on one of them opens detailed information. When content is loaded, only 6 are displayed. Question:
How can I make sure that when the user clicks on the "Load more" button, 6 articles are loaded from the database?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
R
Robur, 2019-03-11
@Denis1111

There are different ways - it depends on how you did it. This is called pagination, there are different ways to do this in general and in mongo in particular, and it is well described in many places.
For example, you can use skip and when you click "download more", set it to 6, 12, 18, and so on.
Or take something like https://github.com/edwardhotchkiss/mongoose-paginate if you don't want to invent your own.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question