Order diff between backend and client with order_by_key()
还没有人认领这个 Issue。
评估
调研方向
使用提供的 JSON,通过 db.reference("/test").order_by_key().limit_to_first(4).get() 重现该报告,并将 OrderedDict 的顺序与 Firebase 的 order_by_key 行为进行比较。跟踪此查询的响应处理过程,并验证返回的键是否保留数据库顺序,以确保使用 start_at 分页时不会重复结果。
由索引模型根据 Issue 内容生成。
描述
Describe your environment
- Operating System version: macOS 12.4
- Firebase SDK version: 6.1.0
- Firebase Product: database
- Python version: 3.7.9
- Pip version: 21.3.1
Describe the problem
When using order_by_key(), the order of the returned OrderedDict is not the same as the database making pagination very difficult
Steps to reproduce:
- Create a collection with this json in "/test" for example :
{
"123": {"myValue": true},
"100001": {"myValue": true},
"100002": {"myValue": true},
"100003": {"myValue": true},
"100004": {"myValue": true},
"100005": {"myValue": true}
}
- Query it with :
db.reference("/test").order_by_key().limit_to_first(4).get()
- Comparison :
Current :
OrderedDict([('100001', {'myValue': True}), ('100002', {'myValue': True}), ('100003', {'myValue': True}), ('123', {'myValue': True})])
Expected :
OrderedDict([('123', {'myValue': True}), ('100001', {'myValue': True}), ('100002', {'myValue': True}), ('100003', {'myValue': True})])
Comments
So according to this link, order should be the same as the collection but in the corresponding OrderedDict the order is not the same so if you want make a pagination strategy, it just loops as getting the last key of the OrderedDict returned and using it in start_at will return the same result over and over again.
- 主要语言
- Python
- 星标
- 1.2k
- 派生
- 359
- 平均合并
- 5 天 6 分钟
- 30 天内合并 PR
- 2
贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
firebase/firebase-admin-python 的其他 Issue
-
api: remoteconfig
难度 2/5 1-3 小时 新手友好度 75/100
firebase/firebase-admin-python#957 · 1 条评论 ·
-
api: database type: feature request
难度 2/5 1-3 小时 新手友好度 62/100
-
难度 4/5 3-5 天 新手友好度 45/100
firebase/firebase-admin-python#978 · 1 条评论 ·
-
[FR] Support VERIFY_AND_CHANGE_EMAIL in generate_email_action_link (parity with firebase-admin-node) 未关闭api: auth
firebase/firebase-admin-python#949 · 2 条评论 · 1 个 reaction · 已指派 1 人 ·
-
难度 4/5 3-5 天 新手友好度 43/100
firebase/firebase-admin-python#945 · 1 条评论 · 1 个 reaction ·
查看 firebase/firebase-admin-python 的全部 Issue
相似的 Issue
-
enhancement
难度 2/5 1-3 小时 新手友好度 70/100
canonical/paas-charm#368 · 1 条评论 ·
-
难度 2/5 1-3 小时 新手友好度 75/100
-
tech debt
难度 2/5 1-3 小时 新手友好度 75/100
-
难度 1/5 1 小时以内 新手友好度 90/100
StevenBlack/hosts#3256 ·
-
难度 1/5 1 小时以内 新手友好度 90/100
qualcomm/qai-appbuilder#275 ·