Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

91
Vistas
Firebase filtering results

I have a question I read from realtime database 1000 last records but I need for example record number 100,200,300... can I do this ? I'm going to make chart and I want for example only show there every 10th measurement. My databse looks like that: enter image description here

 firebase.database().ref("Humidity").ref.orderByChild("time").limitToLast(1000).on("child_added",snapshot => {

about 4 years ago · Juan Pablo Isaza
1 Respuestas
Responde la pregunta

0

It sounds like you're trying to built offset-based pagination, where you first show the most recent 100 messages, then the next 100, etc. That is not how pagination in Firebase works.

Pagination on Firebase follows a cursor model, and is based on knowing an anchor node. For example, if you've first shown the 100 most recent messages, you know the timestamp and key of the oldest message you've shown. You can then get the 100 messages before that with:

firebase.database().ref("Humidity")
  .orderByChild("time")
  .endAt(oldestTimeValue, oldestKey) // 👈 new
  .limitToLast(100)
  .on("child_added",snapshot => {

This:

  • orders the nodes by their time value.
  • finds the node whose time is oldestTimeValue and whose key (typically a push key like -M...) is oldestKey (just in case there are multiple nodes with the same time value).
  • then takes the 100 nodes before that one.
about 4 years ago · Juan Pablo Isaza Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda