I’m trying to access all documents from my firestore collection but it’s throwing this err FirebaseError: Expected type ‘Tc’, but it was: a custom Ac object Answer The getDoc() method is used to get a single document and takes a DocumentReference as a parameter. Here todoRef is a Colle…
Tag: google-cloud-firestore
Firebase 9 – How to do new doc ref
Hello guys i’ve been trying to convert this code into modular firebase 9: fb8: const userRef = db.collection(‘Users’).doc(); to fb9: const userRef = doc(db, ‘Users’); But i’m getting this error: FirebaseError: Invalid document reference. Document references must have an eve…
Firestore: Unable to read document data (Uncaught TypeError: docSnap.exists is not a function at HTMLFormElement)
I am a new developer with no experience in Web apps. I have a collection called “users” in Firestore in which the document IDs are the user’s emails. I am trying to read the data in one of the documents following the example provided by Firebase here I get two errors: First one is the use of…
delete a collection with document and collection again inside (firestore react native)
I am having trouble deleting on firestore here’s my delete but everytime i try to delete nothing happens . There’s no error at all . this is how I set that collection Answer If you want to delete all the docs of the messages (sub)collection, you need to query the collection and delete each documen…
Is there a way to get all data from a firestore database using useCollectionData()?
I have a React project and in it I have the following code: (using this react hook for firebase) Instead of this, I don’t want the query to be ordered or have a limit, is there a way to make an “empty” query to get all the data from a certain collection? Answer If you pass messagesRef instea…
Firebase Firestore db.collection is not a function
I am developing a shift scheduler and I use firebase authentication and firestore. My idea is that when a user signs up it creates a document in collection “workers” and sets the doc id to the user’s email. When the user adds a shift I want to add the shift info into a sub-collection “…
Firebase v9 ,Cannot get document from a nested collection
I feel like it was easier to get subcollection in v8 ,It’s been like 2 days trying to do it the new way but I gave up. Im building a simple react social media app for learning purposes. where each user logs in and be able to post some text (and images but not atm), I have a main collection
Users duplicate on Firestore when I use googleSignIn
I have two ways to register a user in Firebase: through email and through Google Sign In. I perform the user registration by email as follows: In other words, in addition to saving the user in Firebase Authentication, I also send their name and email to Firestore. And this is my first question: Is it the most…
How can I decrement a field value from firestore after submitting a form successfully?
I have these collection of items from firestore: availability : true stocks: 100 item: item1 I kind of wanted to decrement the stocks after submitting the form: I have these where() to compare if what the user chose is the same item from the one saved in the firestore. This is how I’ll submit my form an…
Firestore: What’s the pattern for adding new data in Web v9?
I have seen in many places that to access nested documents and collections the pattern is something like db.collection(“users”).doc(“frank”).collection(“pets”) etc. This makes a lot of sense to me and is easy to understand. The trouble is, my (React) project is set up in th…