[英]Firebase sort collection by field
I have a FireBase Collection ('Messages'):我有一个 FireBase 集合(“消息”):
I want to sort the collection by specifiec field ('timeStamp').我想按特定字段('timeStamp')对集合进行排序。
You should definitely read the documentation on ordering query results .您绝对应该阅读有关订购查询结果的文档。 Use the
orderBy
method to specify which field should be sorted.使用
orderBy
方法指定应该对哪个字段进行排序。
firestore.collection("messages").orderBy("timeStamp")
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.