Skip to content

Latest commit

 

History

History
129 lines (70 loc) · 3.03 KB

isel-AVE-2021-FireStore-get-started.md

File metadata and controls

129 lines (70 loc) · 3.03 KB

FireStore database is a cloud-hosted, NoSQL database that may store JSON documents. FireStore databases are managed within a FireBase project, thus you have first to create a Firebase project, following next steps.

At the end you will create a simple Dotnet console application to get your JSON documents.

  1. https://firebase.google.com/
  2. You should be logged in with a google account.
  3. Click on “Get started”

drawing

  1. Click on “Create Project”

drawing

  1. Give a name to your project. A unique identifier will be proposed for your project (Remember it! You will need it later to access your project).

drawing

  1. Choose whether you want to track with Google analytics or not. It is your choice.

drawing

  1. Create Project. It will take a while.

drawing

  1. Proceed with continue

drawing

  1. Expand the Build menu and select Firestore Database

drawing

  1. Click on “Create Database”

drawing

  1. Start in production mode

drawing

  1. Set your location

drawing

  1. Wait …

drawing

  1. Start a new Collection
  2. Give the collection ID “students”

drawing

  1. Select Auto-ID and add two fields for your first document: name and number

drawing

  1. Add a couple of more documents with the same structure: name and number.

drawing

  1. Select Project Settings

drawing

  1. Service and Accounts

drawing

  1. Generate a new private key

drawing

  1. Generate Key

drawing

  1. Download and later copy it to the AppFireStudents project folder.

drawing

  1. Create a dotnet console application to access your fire-students database

drawing

  1. cd AppFireStudents
  2. Open https://www.nuget.org/
  3. Type on search: google cloud firestore
  4. Select Google.Cloud.Firestore by: google-cloud

drawing

  1. Copy .NET CLI command

drawing

  1. Paste

drawing

  1. Type cat AppFireStudents.csproj and you will observe:

drawing

  1. Paste here, in the AppFireStudents folder, the json file downloaded in step 22.

  2. Set an environment variable GOOGLE_APPLICATION_CREDENTIALS with the path to the json file, such as (notice in Linux use EXPORT rather than SET):

drawing

  1. Write the following Program.cs. NOTICE that you should use your project ID on line 9 where you find FirestoreDb.Create("USE here YOUR Project ID"); (e.g. fire-students). On step 19 of this guide you may find your Project ID.

drawing

  1. dotnet run should produce something like:

drawing