Model randomly doesnt expose all records in it

We have a model that randomly leaves out just 1 record when we do our builds. We have run the query in the playground and the record is missing. Then it randomly comes back. Its not the same record each time. Usually pushing a rebuild fixes it OR resaving the record thats missing. The model on our account is called PRODUCT

We can always see the record in the editor but not in the explorer or using apollo

query MyQuery {
  allProducts(orderBy: _updatedAt_DESC) {
    slug
    title
    _status
  }
}```

Hmm, is this possibly a pagination issue? By default a query only returns 30 20 records unless you specify more. If you’re sorting by updated, it will be the 30 20 most recently edited, which may be different between calls if your content is frequently edited?

You can get pages of up to 100 records at a time: Pagination β€” DatoCMS

If you need more than 100 at a time, you can paginate through them or fetch the pages in parallel.

If you need a specific set of records each time, you can also filter them by specific IDs.

Its only 21 records and we are getting 20 back. What weird is this time we are getting all of them in the playground. I think the playground. is only showing us 20 but if we filter it we get it.

Yikes, sorry, I was wrong again. I just checked and the default limit is actually 20, not 30. I just tried it on your actual project. With your query, I only get 20 results too:

image

But if I add the first parameter to it, I can see all 21 (zero-indexed):

image

image

The modified query is simply:

query MyQuery {
  allProducts(orderBy: _updatedAt_DESC, first: 100) {
    slug
    title
    _status
  }
}

Does that produce more consistent results for you?

Yes that was the issue. Thanks

1 Like