【问题标题】:python Firestore OrderBy and Where conflictpython Firestore OrderBy 和 Where 冲突
【发布时间】:2020-07-19 03:47:42
【问题描述】:
docs = db.collection(u'scylla').where('status', '==', 0).order_by('last_time').limit(10).stream()
for doc in docs:
    print(doc.id, doc.get('last_time'))

为什么我创建索引时不起作用

【问题讨论】:

标签: python google-cloud-firestore


【解决方案1】:

order_by('last_time') 是升序的,所以你需要一个last_time 的升序索引:

scylla    status: ASC    last_time:ASC

【讨论】:

    猜你喜欢
    • 2019-10-30
    • 1970-01-01
    • 1970-01-01
    • 2020-02-04
    • 1970-01-01
    • 2017-06-12
    • 2021-06-21
    • 1970-01-01
    • 2020-05-28
    相关资源
    最近更新 更多