如何在 Firestore 中订购文档? [英] How can I order the documents in Firestore?

查看:26
本文介绍了如何在 Firestore 中订购文档?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何在 Firestore 中订购文档?Firestore 似乎按照我让 Firestore 自动创建的 ID 按字母顺序列出了文档.但我不想那样.我只想看到我新添加的文档添加为集合中的最后一个文档.我怎么做?我应该创建自己的字母 ID 吗?

How can I order the documents in Firestore? It looks like Firestore lists documents in alphabetic order by the ID I let Firestore automatically create. But I don't want that. I just want to see my newly added document added as the last document in the collection. How do I do that? Should I create my own alphabetic ID's?

我在 Firestore 中的收藏示例:

Example of my collection in Firestore:

推荐答案

Firestore 旨在大规模扩展.在这种规模下,文档在控制台中的显示顺序无关紧要,因为控制台对于查看集合中的大量文档毫无用处.

Firestore is meant to scale massively. At that scale, it doesn't matter what order the documents appear in the console, because the console is useless for viewing massive numbers of documents within a collection.

如果您仍需要在控制台中进行排序,则必须提供您自己的文档 ID.

If you still need an ordering in the console, you will have to come up with document IDs of your own.

这篇关于如何在 Firestore 中订购文档?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆