Giter VIP home page Giter VIP logo

firestore-get-document-subcollections's Introduction

firestore-get-document-subcollections

A small Firebase project demonstrating how to fetch all the subcollections of a Firestore document.

The project is composed of:

  • A Cloud Function that fetches the subcollections of a Document;
  • A simple HTML page that demonstrates how it works from a web client.

It demonstrates the approach presented in the following article: https://medium.com/firebase-tips-tricks/how-to-list-all-subcollections-of-a-cloud-firestore-document-17f2bb80a166

How to use it?

Deploy it to one of your Firebase project

  • Clone the project $ git clone https://github.com/rtarnec/firestore-get-document-subcollections.git
  • Install the packages locally by doing $ npm install in the functions directory
  • From the project root directory, list your existing Firebase projects ($ firebase projects:list)
  • Choose, from the list, the Firebase project you want to use for deployment (If you don't have any Firebase project -or you want to use a new project-, create one in the Firebase console https://console.firebase.google.com/, and re-do $ firebase projects:list)
  • IMPORTANT Adapt in the public/index.html file, the Firebase config object with your own project config. See https://firebase.google.com/docs/web/setup#config-object.
  • Deploy the project by doing $ firebase deploy

Use a browser to open the unique HTML page of the project (i.e. index.html)

After deployment to Firebase, open the root url of the project (https://your-project-id.firebaseapp.com) with your preferred browser.

Enter a document path in the dedicated field and click the button "Get Subcollections":

  • If the document has one or more subcollections the page will display their list and fetch each document of each subcollection.
  • If the document at the path does not exist or if it does not have any subcollection, the Cloud Function will return an empty array.

firestore-get-document-subcollections's People

Contributors

rtarnec avatar

Stargazers

Nico avatar  avatar たに avatar Jamal Dahbur avatar Mehmet Akif DERE avatar Sean Wei avatar jinsun Park avatar MOhan  avatar  avatar Alexandre Salvatore avatar William Gyasi avatar Frank Andrade avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.