Hacktoberfest 2026: le issue che i maintainer hanno segnato per ottobre, aperte e adatte ai principianti. Sfoglia le issue Hacktoberfest

Order diff between backend and client with order_by_key()

Aperta
#677 2 commenti 1 reazione 0 assegnatari Vedi su GitHub

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
3/5
Tempo stimato
1-2 giorni
Idoneità per principianti
55/100
Tipo di issue
Bug
Chiarezza
Abbastanza chiara
Stato di attività
Attiva
Stack tecnologico
python
Ambito
database

Direzione di ricerca

Riproduci il report con db.reference("/test").order_by_key().limit_to_first(4).get() usando il JSON fornito e confronta l’ordine di OrderedDict con il comportamento di order_by_key di Firebase. Traccia la gestione della risposta per questa query e verifica che le chiavi restituite preservino l’ordine del database, in modo che la paginazione con start_at non ripeta i risultati.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

api: database
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.

Lingua principale
Python
Stelle
1.2k
Fork
359
Merge medio
5g 6m
PR unite (30g)
2

Guida per i contributori

Apri la guida per i contributori

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di firebase/firebase-admin-python

Tutte le issue di firebase/firebase-admin-python

Issue simili

Altre issue su Python

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.