Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

247
Visualizações
Realtime Database Web: Is it possible to only get values?

I have a realtime db entries as shown below:

{
        <FIREBASE_GENERATED_KEY>:{username:<NAME>,message:<TEXT>,time:<TIMESTAMP>},
        <FIREBASE_GENERATED_KEY>:{username:<NAME>,message:<TEXT>,time:<TIMESTAMP>},
        ...
}

I am interested in getting only the values ordered by time in descending order and displaying them on UI. In Admin SDK I would do something like:

rdb
      .ref(`${rdb_paths.funfuse_connected_users}/${loc}`)
      .orderByValue('time')
      .get()

I see there's a method orderByValue but It doesn't take any arguments. How can we use orderByValue or anything to just get values instead of the entire object?

about 4 years ago · Juan Pablo Isaza
1 Respostas
Responde à pergunta

0

The Firebase Realtime Database always returns complete nodes from the JSON, or a set of complete child nodes that math a certain condition. There is no way to get a subset of the properties for each child node.

If you find yourself regularly needing only the time property of each child node, consider adding another branch to your database where you just keep the time values.

So:

"Original_data": {
        <FIREBASE_GENERATED_KEY>:{username:<NAME>,message:<TEXT>,time:<TIMESTAMP>},
        <FIREBASE_GENERATED_KEY>:{username:<NAME>,message:<TEXT>,time:<TIMESTAMP>},
        ...
},
"Times": {
        <FIREBASE_GENERATED_KEY>: <TIMESTAMP>,
        <FIREBASE_GENERATED_KEY>: <TIMESTAMP>,
        ...
}
about 4 years ago · Juan Pablo Isaza Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda