I have the next function using firebase in an JavaScript app. The query works fine the first time because lastDoc isn’t defined so it gets the first 7 documents in the database, but the next time when there’s a lastDoc, the query keeps returning the same first 7 docs. The lastDoc variable is updat…
Tag: google-cloud-firestore
Saving data to Firestore from Google Cloud Function
I have a function I’ved deployed and scheduled to run every morning into my Google Cloud Functions. It says it runs successfuly and I even see some of the console logs I haven’t taken out yet, but when I look at my firestore collection the data isn’t updated. If I run this same function loca…
How to delete a field inside Firestore document – The field’s key contains dots
I am trying to delete a field inside a Firestore document using the KeyPath method. In other words, I am converting the request body into keyPath string. Example, converting the below request body: Into keyPath: “preferences.settings.v1.4.3” and then using this keyPath to delete the path using the…
I want to connect react and firebase
I have problem with Firebase and React. This problem is after click to my add-data button for adding data to database. I get this console.log Reference_impl.ts:482 Uncaught TypeError: db._checkNotDeleted is not a function at ref (Reference_impl.ts:482:1) at insertData (Modal.js:44:1) at HTMLUnknownElement.cal…
How to toggle a Boolean field in Firebase 9
I want to toggle a Boolean field value in Firebase 9. I’m using Vue 3 If the value of isFav is true I want to make it false onclick If the value of isFav is false I want to make it true onclick It works fine when I set the value of isFav to just false or true. But setting
Should I use router.isReady when fetching with react-query?
Been stuck on this issue for some time now trying to retro fit react-query in to my codebase. I have a working version using getStaticProps. I have been experimenting with router.isReady from next/router to try and force the page to wait for the router.query value to be present before passing it as props to t…
Problem with rendering user’s data from Firebase/Firestore using ReactJS
I’m fetching the user’s data by the user’s UID from Firestore using ReactJS into a table. First, it shows all the data from all the documents of all the users in the table, only after I refresh the page, I can see only the logged-in user data. In addition, if I change something in the code, …
How can I check if a firebase Reference is empty before fetching it?
I’m trying to fetch a specific document from firebase. If it exists, great. But if it doesn’t, I don’t want it to break my app. I just want it to move on. However, I can’t seem to shake off this error: my error Here is my code: Firebase gurus, please help me, I’m going crazy soon…
How to do CRUD operations on a firestore DB from a cloud function? (Node.js)
I use a cloud function as a webhook receiver, so every time I get a webhook I want to update firestore with some data for example. I don’t get how to use firestore in my clound function. I tried this: All do not seem to be able to initilise this. I also tried: Answer As explained in the documentation, t…
firestore query optional filters: Do I have to create an index for every possibility?
I undestand that I need an index for longer search querys in firestore. I am querying my docs like this: There are curretnly 5 tags in total, so do I have to create an index for every possible combination of tags? Because if so, I think I would have to have 120 (5 * 4 * 3 * 2) indexes.