Skip to content

Instantly share code, notes, and snippets.

@Mgancita
Created February 22, 2022 19:46
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Mgancita/7ada50d7d52a221de2bcce1dd9776a6e to your computer and use it in GitHub Desktop.
Save Mgancita/7ada50d7d52a221de2bcce1dd9776a6e to your computer and use it in GitHub Desktop.
from firebase_admin import firestore
db = firestore.client()
data = {
u'name': u'Los Angeles',
u'state': u'CA',
u'country': u'USA'
}
# Add a new doc in collection 'cities' with ID 'LA'
db.collection(u'cities').document(u'LA').set(data)
# Read data back in
db.collection(u'cities').document(u'LA').get()
# {
# u'name': u'Los Angeles',
# u'state': u'CA',
# u'country': u'USA'
# }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment