Reputation: 38
All I'm attempting to do is to grab the names of the docs which have an array inside of them called users with a specifc uid.
Here is how my Firestore is setup:
Rooms is the root, and the docs that would show up in this case would be "RP Rooms Community" and "Test Room"
I run this code
const GetRooms = async () => {
const roomsRef = collection(db, 'Rooms');
const userRoomsQuery = query(
roomsRef,
where('users', 'array-contains', currentUser.uid)
);
console.log(userRoomsQuery);
};
It gives me this error:
Any idea on what I can change to get this error to not keep showing up ? Somehow the doc info does get through sometimes if I'm not refreshing and instead change something in the webapp that causes the doc data to load correctly with the console.log
Upvotes: 0
Views: 120
Reputation: 31
It looks like your where() doesn't meet the prescribed method, e.g
let collectionRef = firestore.collection('col');
collectionRef.where('foo', '==', 'bar').get().then(querySnapshot => {
querySnapshot.forEach(documentSnapshot => {
console.log(`Found document at ${documentSnapshot.ref.path}`);
});
});
Check here for more details https://googleapis.dev/nodejs/firestore/latest/CollectionReference.html#where
Upvotes: 1