Open Barbapapazes opened 1 year ago
In the same time, a count method could be awesome.
+1 for adding a count method. Currently have to run a queryContent
for all content to get total, then perform a pagination calc, then re-run queryContent
with skip and limit.
// fetch the next 5 articles
const articles = await queryContent('articles')
.skip(5)
.limit(5)
.find()
// fetch the next 5 articles const articles = await queryContent('articles') .skip(5) .limit(5) .find()
Yes but No because with this approach, you won't be able to know when you reach the last page and you will have to have another request to have the number of articles. The request to get the number of articles, you will transfert all content, not just a simple number.
// fetch the next 5 articles const articles = await queryContent('articles') .skip(5) .limit(5) .find()
Yes but No because with this approach, you won't be able to know when you reach the last page and you will have to have another request to have the number of articles. The request to get the number of articles, you will transfert all content, not just a simple number.
Yeah, I do not argue, it is necessary in the nuxt/content
l'm currently building a large application using Content. In order to have a better UX, I'm looking for a way to paginate data.
Like
find
orfindOne
we could havepaginate
. (I can simulare this using skip and limit but I don't have a way to count all).Behind the scene, Content fetch data, count and create pagination to return
Reference: