In this recipe, you will see how to create a Cloud Firestore database and integrate it into your projects. To be more specific, you will ask users whether they prefer ice cream or pizza, and store the results in your database:
- From the Build menu on the left of the Firebase console, click on the Firestore Database menu item. This will bring you to the Cloud Firestore page, as shown in the following screenshot:
- Click on the Create Database button, choose the Test mode option, which keeps data open without authorization rules, and then click Next.
- Choose the Cloud Firestore location. Generally, prefer regions that are closer to where you and your users will access data.
- Click the Enable button. After a few seconds, you should see your Cloud Firestore database, as shown here:
- Click on the Start Collection link.
-
Set the collection ID to poll and then click Next.
-
For the document ID, click the Auto-ID button.
- Add two fields, one called icecream, with a type of...