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

2

6

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?

Fernyak answered 28/4, 2019 at 0:6 Comment(0)
P
4

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

Pocosin answered 30/4, 2019 at 15:10 Comment(4)
This answer is unfortunately still acurate. Command line / API support is still pretty bad in january 2020.Telegraphic
Actually, you can use the command line with gcloud alpha datastore/firestore databases create (cloud.google.com/sdk/gcloud/reference/alpha/datastore/databases, cloud.google.com/sdk/gcloud/reference/alpha/firestore/databases)Pocosin
I stand corrected Jim, I did not check the alpha commands. So it appears more support is slowly coming. Hopefully the APIs can also be used for Terraform soon.Telegraphic
Despite the alpha command group's description of manage Creation of Cloud Firestore in Native mode Database, the only command in the group is create with Create a Google Cloud Firestore in Datastore Mode database. The output of the command is Success! Confirmed selection of a Google Cloud Firestore in Datastore Mode. So there really is no way to create/switch it to Native without the Web UI Console.Hebraize
H
2

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.

Hackett answered 3/1, 2022 at 10:56 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.