Is this the data duplication you are talking about? During the page turning process, someone inserted a piece of data, and then the last piece of data on the first page was assigned to the second page again and became the first output piece on the second page. , this piece of data appears twice?
If that’s what you mean, I suggest you do paging on the client. When querying, add a time point. Data that is less than the time when you click the query button will be found, and then perform paging on the client. In this way, new data will not be retrieved. It will affect paging because the new data is not retrieved at all. Since this is a time flashback, even if there is new data, it will not be seen and there will be no data omission. When the data is loaded again and the data is fetched, the new data will be queried.
I just dealt with a similar problem on the mobile side some time ago. Let me talk about the ideas on the mobile side:
1. First, it is divided into pulling down (getting the latest data) and sliding up (getting the previous data).
2. Secondly, swiping up every time to get it. In the previous data, I would pass an id and use this id as a condition to obtain the data. If you are in reverse order of time, you can basically assume that the id is also in reverse order. The id just passed should be the smallest id in the previously obtained data. Except for the first time, every time you obtain data in the future, it will be data smaller than this id
3, first When getting data for the first time, because there is no ID, just get the first data in order.
Hope this helps with your question!
Sorry is the best language in the world.
My answer is based on nodejs.
But it doesn’t matter, just understand the idea.
-------Original answer------
When I looked at the API of coding.net, I found that it has two more methods.
The syntax is based on mongoose
One is through paging and pagify. For example, if there are 20 pages, Model.find(query).skip(page*20 - 20).limit(20).
The second is to load more after, specifically after. I have never developed anything like this, and I am not sure if mongodb has such an attribute after. However, it is relatively simple to rely on things in a sort, Model.find(query).sort('-time').where({time:{$gt:TIME}}).limit(20)
It would be better if mongodb has something similar to after. (note time may crash, but id will not)
Model.find(query).sort('-time').after({id:ID}).limit(20)
GET https://coding.net/api/activities/projects_last?last_id=14959187