Skip to content

Commit

Permalink
fix naming convention for read collection
Browse files Browse the repository at this point in the history
  • Loading branch information
frankogenrwoth committed Jun 28, 2023
1 parent 0b6239b commit b249bbc
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 2 deletions.
7 changes: 7 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,12 +28,19 @@ handler = FirebaseHandler('path/to/credentials.json')
# Create a document
data = {'name': 'John Doe', 'age': 30}
document_id = handler.create_document('users', data)

## for creating a document with a custom reference
document_id = handler.create_document('users', data, custom_ref="id01")
print(f"Created document with ID: {document_id}")

# Retrieve a document
document_data = handler.get_document('users', document_id)
print(f"Retrieved document data: {document_data}")

# Retrive list of documents from a collection
collection_data = handler.read_collection('users')
print(f"Retrieved list of collection data: {document_data}")

# Update a document
updated_data = {'age': 31}
handler.update_document('users', document_id, updated_data)
Expand Down
2 changes: 1 addition & 1 deletion pyfirebasehandler/firebase_handler.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ def delete_document(self, collection_path, document_id):
doc_ref = collection_ref.document(document_id)
doc_ref.delete()

def readCollection(self, collection_path):
def read_collection(self, collection_path):
docs = self.db.collection(collection_path).stream()

collection_data_list = list()
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

setup(
name="pyfirebasehandler",
version="9.9.9",
version="1.0.0",
description="A Python module for handling a Firebase database",
long_description=long_description,
long_description_content_type="text/markdown",
Expand Down

0 comments on commit b249bbc

Please sign in to comment.