Skip to content

Instantly share code, notes, and snippets.

@ryanmats
Created April 17, 2018 06:18
Show Gist options
  • Save ryanmats/6c587c4feec696e19b6cd99cfa2c1422 to your computer and use it in GitHub Desktop.
Save ryanmats/6c587c4feec696e19b6cd99cfa2c1422 to your computer and use it in GitHub Desktop.
require "google/cloud/firestore"
firestore = Google::Cloud::Firestore.new(project_id: project_id)
cities_ref = firestore.col "cities"
query = cities_ref
query.get do |document_snapshot|
puts "Deleting document #{document_snapshot.document_id}."
document_ref = document_snapshot.ref
document_ref.delete
end
puts "Finished deleting all documents from the collection."
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment