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

查看:59
本文介绍了如何在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天全站免登陆