【问题标题】:Cloud firestore get all documents between two ids of documentsCloud Firestore 获取两个文档 ID 之间的所有文档
【发布时间】:2021-05-24 09:00:00
【问题描述】:

我有一个集合,所有文档 ID 都为 epochtime(1613728796)。这些文档中的每一个都包含多达 50 个字段。我想查询特定时间之间的文档集。如何根据文档的 uid 进行查询?

Query query = db.collection("my-collection").whereGreaterThan("uid", "1613728796")

【问题讨论】:

    标签: java google-cloud-firestore epoch


    【解决方案1】:

    试试这个:

    Query query = db.collection("my-collection").whereGreaterThan("__name__", "1613728796").whereLessThan("__name__", "1613728796")
    

    用正确的时间替换上面的纪元时间。

    如果这不起作用,请尝试将 "__name" 替换为 FieldPath.documentId()FieldPath.documentId

    【讨论】:

    • 是的...FieldPath.documentId() 适用于 7.1.0 版本,谢谢。
    猜你喜欢
    • 2022-12-03
    • 1970-01-01
    • 2021-07-20
    • 2018-09-03
    • 1970-01-01
    • 1970-01-01
    • 2018-12-05
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多