云开发怎么从集合的后面获取数据啊,或者怎么将新数据插到集合的最前面?

小程序 文章 2021-03-23 08:41 438 0 全屏看文

AI助手支持GPT4.0

云开发怎么从集合的后面获取数据啊,或者怎么将新数据插到集合的最前面?How does cloud development get data from the back of the collection, or how to insert new data at the top of the collection?

云开发怎么从集合的后面获取数据啊,或者怎么将新数据插到集合的最前面?

做一个翻页功能,要求第一页是最新信息,但是我发现云开发数据库只能是将新数据插入到集合最后,然后从集合最前面获取数据。

有没有什么办法,能够实现从集合的后面获取数据,或者将新数据插到集合的最前面?(求助求助

orderBy那个方法我试过了,实际上是相当于将获取到的数据做一个排序,而不是将集合中的数据排序好以后再获取。

To do a page turning function, the first page is required to be the latest information, but I found that the cloud development database can only insert the new data to the end of the collection, and then get the data from the front of the collection. Is there any way to get data from the back of the set, or insert new data to the front of the set? (I tried the method of orderby. In fact, it is equivalent to sorting the acquired data, rather than sorting the data in the collection.

回答:

蓝天:写下会打
张杰 ༽ Mark:

正常储存在集合后面,取出来是以数组最后一个出现在最前面(array.length)

铅笔画不出蜡笔的味道:

新增一个时间字段,获取的时候降序

-EOF-

AI助手支持GPT4.0