I'm trying to paginate a collection using a map field, but I get an error when trying to fetch the second page:
l050ZZ1bAsBddd7hE1GD => {'wordcount': {'page3': 130, 'page2': 120, 'page1': 100}, 'availability_date': DatetimeWithNanoseconds(2019, 3, 4, 6, 0, tzinfo=<UTC>), 'count': 100}
JCn6BxwfEDIvirnkMyOf => {'wordcount': {'page3': 180, 'page2': 120, 'page1': 150}, 'availability_date': DatetimeWithNanoseconds(2019, 3, 4, 6, 0, tzinfo=<UTC>), 'count': 150}
nfW0ybNz4WPGWtikfVK2 => {'count': 200, 'wordcount': {'page3': 50, 'page2': 100, 'page1': 200}}
last value: 200
Traceback (most recent call last):
File "/home/ctorres/.local/lib/python3.5/site-packages/google/cloud/firestore_v1/query.py", line 642, in _normalize_cursor
values.append(field_path_module.get_nested_value(order_key, data))
File "/home/ctorres/.local/lib/python3.5/site-packages/google/cloud/firestore_v1/field_path.py", line 243, in get_nested_value
raise KeyError(msg)
KeyError: "'wordcount' is not contained in the data"
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "firestore_pagination.py", line 28, in <module>
docs_list = list(docs)
File "/home/ctorres/.local/lib/python3.5/site-packages/google/cloud/firestore_v1/query.py", line 736, in stream
self._to_protobuf(),
File "/home/ctorres/.local/lib/python3.5/site-packages/google/cloud/firestore_v1/query.py", line 675, in _to_protobuf
start_at = self._normalize_cursor(self._start_at, orders)
File "/home/ctorres/.local/lib/python3.5/site-packages/google/cloud/firestore_v1/query.py", line 645, in _normalize_cursor
raise ValueError(msg)
ValueError: The "order by" field path 'wordcount.page1' is not present in the cursor data {'wordcount.page1': 200}. All fields sent to ``order_by()`` must be present in the fields if passed to one of ``start_at()`` / ``start_after()`` / ``end_before()`` / ``end_at()`` to define a cursor.
The equivalent query for nodejs works without issue, so I'm assuming that this is supported although it's not explicitly mentioned in the documentation.
Describe your environment
Describe the problem
I'm trying to paginate a collection using a map field, but I get an error when trying to fetch the second page:
Attached code:
requirements.txt
firestore_pagination.txt
Steps to reproduce:
What happened? How can we make the problem occur?
This could be a description, log/console output, etc.
The equivalent query for nodejs works without issue, so I'm assuming that this is supported although it's not explicitly mentioned in the documentation.
Relevant Code:
firestore_pagination.py