I want to get a snapshot of a Book
by its document ID.
My structure looks like this:
stores
/ \
Store1 Store2
| |
books books
/ \ / | \
Book1 Book2 Book3 Book4 Book5
(stores
is a collection)
I tried with a collection group:
my_id = "XXXYYYZZZ" # I know that there is a book with this ID
firestore.Client.collection_group('books').where('id', "==", my_id)
But it looks for id
field instead of document ID.
I tried also to read all Book
documents and filter by ID in Python, but I have maaany books, so that's not an option.
books = firestore.Client.collection_group('books').get()
book = [b.id for b in books if b.id == my_id]
And I cannot define a specific path to the document, because I have multiple stores.
What can I do?