0
votes

I currently have a firebase project on android. I originally set up a realtime database, then attempted to add cloud functions, but decided to switch to firestore.

I added a firestore database, but the cloud functions would not route there and instead added to the RTDB. I disabled the RTDB and started getting the error that the "database ___ has been disabled by the owner".

I have resulted reverting my code back to before I set up cloud functions, and re set it up with only the Firestore available. It still tries to write to the RTDB even though it is disabled (still shows in console though).

How do I route it to firestore? Thanks

For reference, I used this to add cloud functions

EDIT: Problem solved, I should have been using Firestore triggers, found here

1
Go through your code base and remove all mentions of firebase.database() and admin.database(). Then work through your code and change your code from the RTDB API to use the Cloud Firestore API using firebase.firestore() and admin.firestore().samthecodingman
Here is the Cloud Firestore API for the Admin SDK. Instead of using new Firestore() from @google-cloud/firestore, use admin.firestore() in it's place.samthecodingman

1 Answers

2
votes

There is no "routing". You have to use the API provided by the database you want to use. Realtime Database and Firestore are completely differere database products, and they don't have the same API or SDK. So if you switch to Firestore, you will have to rewrite all your code to use its SDK instead of Realtime Database.