Skip to content

Commit bf7d37b

Browse files
authored
Remove unnecessary order_by field in a query (GoogleCloudPlatform#5736)
The start_at_name query has an extra order_by that causes an error. Removes the following error: ValueError: The "order by" field path 'state' is not present in the cursor data {'name': 'Springfield'}. 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. ## Description Fixes #<ISSUE-NUMBER> Note: It's a good idea to open an issue first for discussion. ## Checklist - [ ] I have followed [Sample Guidelines from AUTHORING_GUIDE.MD](https://github.com/GoogleCloudPlatform/python-docs-samples/blob/master/AUTHORING_GUIDE.md) - [ ] README is updated to include [all relevant information](https://github.com/GoogleCloudPlatform/python-docs-samples/blob/master/AUTHORING_GUIDE.md#readme-file) - [ ] **Tests** pass: `nox -s py-3.6` (see [Test Environment Setup](https://github.com/GoogleCloudPlatform/python-docs-samples/blob/master/AUTHORING_GUIDE.md#test-environment-setup)) - [ ] **Lint** pass: `nox -s lint` (see [Test Environment Setup](https://github.com/GoogleCloudPlatform/python-docs-samples/blob/master/AUTHORING_GUIDE.md#test-environment-setup)) - [ ] These samples need a new **API enabled** in testing projects to pass (let us know which ones) - [ ] These samples need a new/updated **env vars** in testing projects set to pass (let us know which ones) - [ ] Please **merge** this PR for me once it is approved. - [ ] This sample adds a new sample directory, and I updated the [CODEOWNERS file](https://github.com/GoogleCloudPlatform/python-docs-samples/blob/master/.github/CODEOWNERS) with the codeowners for this sample
1 parent bd3c61d commit bf7d37b

File tree

1 file changed

+1
-2
lines changed

1 file changed

+1
-2
lines changed

firestore/cloud-client/snippets.py

+1-2
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
# you may not use this file except in compliance with the License.
55
# You may obtain a copy of the License at
66
#
7-
# http://www.apache.org/licenses/LICENSE-2.0
7+
# http://www.apache.org/licenses/LICENSE-2.0
88
#
99
# Unless required by applicable law or agreed to in writing, software
1010
# distributed under the License is distributed on an "AS IS" BASIS,
@@ -814,7 +814,6 @@ def cursor_multiple_conditions():
814814
start_at_name = (
815815
db.collection(u'cities')
816816
.order_by(u'name')
817-
.order_by(u'state')
818817
.start_at({
819818
u'name': u'Springfield'
820819
})

0 commit comments

Comments
 (0)