Skip to content

Latest commit

 

History

History
93 lines (61 loc) · 1.62 KB

File metadata and controls

93 lines (61 loc) · 1.62 KB

GSP642 - Importing Data to a Firestore Database

Task 1. Set up Firestore in Google Cloud

  1. Navigation menu > Firestore >Select Native Mode

  2. Clone the repository

    git clone https://github.com/rosera/pet-theory
  3. Ubah direktori

    cd pet-theory/lab01

Task 2. Write database import code

  1. Install package

    npm install @google-cloud/firestore
    npm install @google-cloud/logging
  2. Ubah kode sesuai dengan petunjuk

Task 3. Create test data

  1. Install package

    npm install [email protected]
  2. Ubah kode sesuai dengan petunjuk

  3. Set Project ID

    gcloud config set project PROJECT_ID
    PROJECT_ID=$(gcloud config get-value project)
  4. buat fake data

    node createTestData 1000

Task 4. Import the test customer data

  1. import data

    node importTestData customers_1000.csv
     node createTestData 20000
     node importTestData customers_20000.csv

Task 5. Inspect the data in Firestore

  • Cek di Firestore

Task 6. Edit and delete data from Firestore

  • Edit dan delete data di Firestore

Task 7. Add a developer to the project without giving them Firestore access

  1. just read the logs

    gcloud projects add-iam-policy-binding $PROJECT_ID \
        --member=user:[email protected] --role=roles/logging.viewer
  2. check code

    gcloud projects add-iam-policy-binding $PROJECT_ID \
        --member=user:<[email protected]> --role roles/source.writer