Q:

firebase where query not functioning

I'm trying to run the following query:
   const getAttendCount = fDB.ref(`organization/${uid}`);
   const query = getAttendCount.where('lastAttendanceCount', 'array-contains', date)
   .then(snapshot => console.log(snapshot.val()))

I get this error:
I have these values:
2020-02-11-PM: 
128
2020-02-16-AM: 
158
2020-02-16-PM: 
164

In the example above I wanted to get the records for 02-16 am and pm.  So my solution was to do. where('lastAttendanceCount', 'array-contains', date)
UnhandledPromiseRejectionWarning: TypeError: getAttendCount.where is not a function

Obviously I'm doing something wrong but not sure what.

A:

You're mixing up the APIs for two different database products.
Realtime Database doesn't have a where() method.  That's only used with Firestore.  If you want to query Realtime Database, you need to identify the node that you want to query, add an ordering to it, and use once() to fetch the results, as shown in the documentation.  I suggest reviewing it.

