Order diff between backend and client with order_by_key()
Nobody has claimed this yet.
Assessment
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Newbie friendliness
- 55/100
Research direction
Reproduce the report with db.reference("/test").order_by_key().limit_to_first(4).get() using the supplied JSON and compare the OrderedDict order with Firebase's order_by_key behavior. Trace the response handling for this query and verify that the returned keys preserve the database order so pagination with start_at does not repeat results.
Written by the indexing model from the issue text.
Description
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.
- Dominant language
- Python
- Stars
- 1.2k
- Forks
- 359
- Avg merge
- 5d 6m
- Merged PRs (30d)
- 2
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from firebase/firebase-admin-python
-
api: remoteconfig
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
firebase/firebase-admin-python#957 · 1 comment ·
-
api: database type: feature request
Difficulty 2/5 1-3 hours Newbie friendliness 62/100
-
Difficulty 4/5 3-5 days Newbie friendliness 45/100
firebase/firebase-admin-python#978 · 1 comment ·
-
[FR] Support VERIFY_AND_CHANGE_EMAIL in generate_email_action_link (parity with firebase-admin-node) Openapi: auth
firebase/firebase-admin-python#949 · 2 comments · 1 reaction · 1 assignee ·
-
Difficulty 4/5 3-5 days Newbie friendliness 43/100
firebase/firebase-admin-python#945 · 1 comment · 1 reaction ·
All issues in firebase/firebase-admin-python
Similar issues
-
Difficulty 2/5 1-3 hours Newbie friendliness 86/100
EleutherAI/lm-evaluation-harness#4207 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
ClickHouse/clickhouse-connect#1057 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 70/100
open-telemetry/sig-end-user#406 ·
-
bug ci good first issue
Difficulty 2/5 1-3 hours Newbie friendliness 88/100