Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

110
Views
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 answers
Answer question

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 Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!