Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to enable Cloud Firestore Native Mode using API / command line?

Tags:

I'm writing a script for setting up a Google Cloud project and I'd like to use Firestore. A new project, however, is by default in Datastore mode.

Switching to Firestore can easily be done using the web interface in the cloud console but I'd like to automate it. Is there any API or command line tool (gcloud? firebase?) for enabling it?

like image 619
ehrencrona Avatar asked Apr 28 '19 00:04

ehrencrona


People also ask

What is Firestore Native mode?

Firestore in Native mode Firestore is the next major version of Datastore and a re-branding of the product. Taking the best of Datastore and the Firebase Realtime Database, Firestore is a NoSQL document database built for automatic scaling, high performance, and ease of application development.

Is cloud firestore an API?

For authentication, the Cloud Firestore REST API accepts either a Firebase Authentication ID token or a Google Identity OAuth 2.0 token. The token you provide affects your request's authorization: Use Firebase ID tokens to authenticate requests from your application's users.


2 Answers

Unfortunately, as of today (30 Apr 2019), there is no API or command line to set the mode for Cloud Firestore.

like image 101
Jim Morrison Avatar answered Sep 23 '22 22:09

Jim Morrison


Things seem to have changed by now (03 Jan 2022). I managed to set up a new Firestore with gcloud using the following commands. Native mode is chosen by default:

gcloud app create --region=us-central
gcloud firestore databases create --region=us-central

also see the documentation for app create and firestore database create.

like image 44
Raste Avatar answered Sep 24 '22 22:09

Raste