Is there any way to check how many read/write on Cloud Firestore via sdk? - firebase

Is there any way to check how many read/write on my app on Cloud Firestore?

There currently is no API to get the number of reads/writes from Cloud Firestore. Neither the client-side SDKs nor the server-side Admin SDKs expose this functionality.
The closest I can think of is something based on StackDriver monitoring that you can set up for Firestore. Based on that you can then wrap the StackDriver monitoring API in a custom end point (either in Cloud Functions or elsewhere).

Related

Do any features of Firebase Cloud messaging require a Firebase database?

I'm thinking about implementing Firebase Cloud Messaging without implementing a firebase database and it's unclear to me which features of FCM are supported without having a firebase database.
For instance, getting message delivery statistics (https://firebase.google.com/docs/cloud-messaging/understand-delivery) and sending notifications via the firebase console (https://firebase.google.com/docs/cloud-messaging/js/send-with-console). It doesn't explicitly say whether you need a firebase database in either of documents but I'd like to clear about that before implementing it.
So my question is, do you need a firebase database to send notifications via the firebase console or to view message delivery statistics? I know for the latter you need to implement google analytics. And also as a bonus, are there any firebase features that depend on having a firebase database?
Thank you
All FCM features are supported without having to use Realtime Database. They are completely separate products, and are only related as much as you want them to be in your app.

Can I create triggers with Admin SDK in my own backend?

I am new to Firebase and learning it. With Cloud Functions you can create trigger listeners to events that happen in Firestore (firestore events) or Authentication (auth events). Can I create listeners similarly with the Admin SDK of Firestore or Authentication in my own nodejs environment?
No, Cloud Functions triggers only work on the Cloud Functions backend, as they depend heavily on Google Cloud infrastructure to work efficiently. There is no exact equivalent for other environments. You can certainly use the provided nodejs Firestore SDK to set up a document or query listener, just like web and mobile clients, but it won't behave like a Cloud Functions trigger.

for a company interested to use only Firestore, what is the differrence between gcloud and Firebase CLI

My straight question is: since I am not interested in other Google Services, only Firestore, what is the difference between Firebase Cli and gcloud? Can I do all I need only with Firebase Cli or should I learn also gcloud?
I can easilly see that gcloud can handle more services than Firebase Cli. Also I can see Firebase Cli remenber me a lot the purpose of npm+ng cli when working with NodeJs/Angular (a simple analogy about scaffold/initialize/deploy). Nevertheless, our company will only use Firestore to take advantage of its Realtime Database pushing events to our mobile application.
I use Firebase Cli to type in my Windows command line and create a project in Firebase. I can see the result in Firebase Console and I also can see it in Console Cloud Plataform.
For me, who is total beginner with Google Cloud Plataform, it is a bit confused when prefer one over other. For instance, let's say I want to query data from Firebase Crashlytics from command line instead of logging from my Browser. Is it possible to use either Firebase Cli or gcloud? If both, which one is recommended for some company only interested in Firestore project?
This week I am struggling to figure out how to extract metrics regard my Firestore project and if I don't know what is the recommended tool for reach this task it make even harder to find the first steps. By extracting I don't mean see a beatifull dash in Google Console. I mean consume an endpoint providing me Firestore Metrics or, even better, subscribe my endpoint to Firestore project which will be called every time some issue happens (Other question asking exactly about getting Firestore metrics)
It is confusing and is partly the result of Google's acquisition of Firebase, the creation of what's now called Firestore (which is the unification of the original Firebase backend technology and Google Cloud Datastore), and that Google provides the Firestore service to both its Firebase and Google Cloud developer audiences.
As you've gathered, Google Cloud's CLI (Cloud SDK aka gcloud) and the Firebase CLI overlap in functionality. However, importantly:
both CLIs interact with a shared set of Google services (e.g. Firestore, identity, logging etc.).
there are some Google Cloud services not part of Firebase and vice versa
If you're focused on Firebase, you should be to able to stick with the Firebase CLI and continue to interact with Google's services through this Firebase lens.
If you include Google Cloud Platform services that aren't part of Firebase, you'll need to then consider using gcloud but importantly, you can either:
continue to use the Firebase CLI for the Firebase services;
use gcloud to interact with some (not all!) of the Firebase services (e.g. Firestore).
Over time, I assume (!) the remain discord between these 2 platforms will diminish.
If you consider both platforms as the result of (an ongoing?) unification since the acquisition, hopefully, these discrepancies will be more understandable and less frustrating.
Where you do find inconsistencies and frustrations, ensure Google knows by submitting feature requests and bugs.

Cloud Firestore & Cloud Firestore for Firebase

What is the difference between Cloud Firestore and Cloud Firestore for Firebase?
Here's a thread asking the same, but someone, please enlighten me.
https://www.reddit.com/r/googlecloud/comments/bb9n46/what_is_the_difference_between_the_cloud/
Is it the same? If not, which one to use?
The link you have shared is talking about the differences between quickstarts, Firestore as a service within GCP and Firestore as a service within Firebase. There also two different consoles for that. Both doing the same thing.
Please note that Cloud Firestore as a service is available with, or without Firebase SDKs.
Is it the same?
The difference that I see between them is that in Firebase console you can set the security rules and you access other services like IAM, BigQuery, more easily.
If not, which one to use?
If you are used to work in a Google Cloud Platform environment, use the Cloud console, otherwise use the Firebase console. So it depends on whatever your preference is.
For more informations, I recommend you read Doug Stevenson's post on medium.com regarding the same topic:
https://medium.com/google-developers/firebase-google-cloud-whats-different-with-cloud-firestore-40f1fc3e6d1e

How do I use Cloud DataStore or Cloud SQL from Cloud Functions for Firebase?

I'm building a Firebase app, and plan to use the real-time database when I need real-time updates. However, most of the application data is more traditional.
Now that Functions is a thing, how do I also leverage either DataStore or CloudSQL? Can anyone point me to specific documentation or examples how to read/write with either of those services from a function?
Neither Cloud Datastore nor Cloud SQL support Cloud Functions yet, which means you aren't yet able to trigger Cloud Functions based on their events the way you can with the Firebase Realtime Database.
Fortunately, once a Cloud Function has been triggered (for example via HTTP), you can still read and write from Datastore and SQL as you would from any other Node.js code. Here is documentation for Cloud Datastore, and here it is for Cloud SQL.
Finally, if you're adventurous and might like to provide early feedback on upcoming integrations like Datastore, fill out this form!

Resources