Skip to content

On software development

DevBlog about human aspects in programming

  • About me

Tag: google-cloud

bookmark_borderHow to delete all documents from a collection in Google Cloud Firestore?

Posted on August 5, 2019August 24, 2023 by kalkus

To delete all documents from a Firebase collection in Firestore we need to get the collection, iterate over its elements and delete each one of them:

const db = new Firestore({
  projectId: "projectId",
  keyFilename: "./key.json"
});

db.collection("collectionName")
  .get()
  .then(res => {
    res.forEach(element => {
      element.ref.delete();
    });
  });
Posted in english, practiceTagged firebase, firestore, google-cloud6 Comments on How to delete all documents from a collection in Google Cloud Firestore?

Language

  • EnglishEnglish
  • PolskiPolski

Recent Posts

  • How to define enum type in Typescript
  • Anonymous code reviews
  • Working code isn’t enough
  • How to delete unused local branches in Git?
  • English names of programming special characters

Tags

agile books clean-code code-review firebase firestore google-cloud JavaScript philosophy-of-programming quality scrum-methodology software-design teamwork typescript

Archives

  • December 2024
  • May 2024
  • April 2024
  • April 2022
  • November 2021
  • December 2020
  • November 2020
  • October 2020
  • May 2020
  • April 2020
  • February 2020
  • January 2020
  • September 2019
  • August 2019
  • July 2019
  • March 2019

Meta

  • Log in
  • Entries feed
  • Comments feed
  • WordPress.org
keyboard_arrow_up
Theme: Noto Simple
This website uses cookies to improve your experience. We'll assume you're ok with this, but you can opt-out if you wish. Cookie settingsACCEPT
Privacy & Cookies Policy

Privacy Overview

This website uses cookies to improve your experience while you navigate through the website. Out of these cookies, the cookies that are categorized as necessary are stored on your browser as they are as essential for the working of basic functionalities of the website. We also use third-party cookies that help us analyze and understand how you use this website. These cookies will be stored in your browser only with your consent. You also have the option to opt-out of these cookies. But opting out of some of these cookies may have an effect on your browsing experience.
Necessary
Always Enabled
Necessary cookies are absolutely essential for the website to function properly. This category only includes cookies that ensures basic functionalities and security features of the website. These cookies do not store any personal information.
SAVE & ACCEPT