How do i check one Field in all Documents in a Collection against a Value?
I am setting up a digital tally for my coworkers to track what we take out of the fridge. we all have a 4 digit number on our Cards we would like to use to log in and then store what we took out of the company fridge (and pay up at the end of the month)
I have one Collection that contains the Users Name and their Number. When i enter my Code i want to check the entire Collection if that entry exists.
My Firebase with Users and ID (nummer)
Following this this post Check if value exists in firebase DB i have my code set up like this:
ref.child("nutzer").orderByChild("nummer").equalTo("1337").once("value",snapshot => {
if (snapshot.exists()){
const userData = snapshot.val();
console.log("exists!", userData);
}
else{
console.log("does not exists!");
});
when running the code i get an Error "ref.child is not a function". trying to figure out why i get this error i found this post: "ref.child is not a function" when adding .orderByChild.StartAt filter but was unable to find a solution to my inital question.
Kind regards.