python-mock-firestore
python-mock-firestore copied to clipboard
In-memory implementation of Google Cloud Firestore for use in tests
Most of the code snippets on how to use a transaction use the decorator @firestore.transactional. What is the proper way to use the transactions with this mock? Official documentation: https://github.com/GoogleCloudPlatform/python-docs-samples/blob/5238ce34cb92b58ddaa2019706caacfa4d7a2009/firestore/cloud-client/snippets.py#L414
I noticed the problem in a test that asserts that a specific document does not exist and then retrieves all other documents from a collection. The previously queried document is...
It seems like the mocked DocumentReference do not have the `create` method described in the firestore documentation: https://googleapis.dev/python/firestore/latest/document.html#google.cloud.firestore_v1.document.DocumentReference.create This results in errors like the following: ```python > doc_ref = collection.document(doc_id)...
Add support for firestore batch writes.
### Issue `firestore` comes with some atomic "transformations" that are used to manipulate data without retrieving the document first, checking the value, then setting it again. These transformations are listed...
Add support for client.collections() that list top-level collections of the client's database. Which was introduced with commit [#7494](https://github.com/googleapis/python-firestore/commit/b9e66acf7d058b139993b804a0b15df89ef3dde6) on firestore client [Documentation of Collections](https://github.com/googleapis/python-firestore/commit/b9e66acf7d058b139993b804a0b15df89ef3dde6)
Non existent docs should raise an exception. Example: ```python try: doc = db.collection('users').document('thisDoesNotExist').get() print(u'Document data: {}'.format(doc.to_dict())) except google.cloud.exceptions.NotFound: print(u'No such document!') ```
Add support for the new `collection_group` query that was recently added. ```python # Example Data parent_1 = db.collection(u'parents').document(u'molly_smith').set({ u'name': u'Molly Smith', u'age': 49 }) child_1a = db.collection(u'parents').document(u'u'molly_smith').collection(u'children').document().set({ u'name': u'Tom Smith...
After #13 is merged, at some point we should make `Transaction.rollback` actually roll the transaction back. This could be done by making a deep copy of the MockFirestore data before...
Adding 2 updates and a test - property id in CollectionReference. This is now supported in firestore - method collection() in DocumentReference. You can now get a list of subcollections...