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

112
Visualizações
Query similar to a where clause in RD

I have the following structure in Realtime Database:

enter image description here

I've read a few questions on SO that it's possible and some say it's not possible so I'm a little confused on if this can be done or not but here goes.

I have multiple members (about 200) and I would like to return only those that are mStatus == true.

I attempted it by doing this:

const dbRef = ref(db, `organization/${org}/members`);
const queryConstraints = [orderByChild("mStatus"), equalTo("value")]
get(query(dbRef, ...queryConstraints)).then((snapshot) => {
  if(snapshot.exists()) {
    console.log(snapshot.val());
  } else {
    console.log('No data available');
  }
})

The return is null here is the security rule I use:

 "rules": {
    ".read": true,
    ".write": true,
      "members": {
        ".indexOn": ["mStatus"]
      }
  }

How would I run this query?

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

0

Since in the comments you said that your members list is under /organization/{uid}/, that is also where you have to define the index in your rules:

{
  "rules": {
    ...
    "organization": {
      "$uid": {
        "members": {
          ".indexOn": ["mStatus"]
        }
      }
    }
  }
}
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