Skip to content

fit & finish: COUNT and OR queries should be available in firestore module #704

@telpirion

Description

@telpirion

Issue

The AggregationQuery, FieldFilter, Or, and And classes are only available in the submodules of firestore_v1. This is an unusual import pattern for this client library. Most Firestore features can be accessed directly from the top-level firestore module.

Examples of normal query usage:

from google.cloud import firestore db = firestore.Client() query = db.collection(u'users').where("birthYear", "==", 1906) docs = query.stream() 

Here's an example of printing out a manual page in IPython:

from google.cloud import firestore help(firestore.CollectionReference) # Prints out manual page for CollectionReference 

Contrast this with usage for Or and FieldFilter:

from google.cloud import firestore from google.cloud.firestore_v1.base_query import FieldFilter, Or client = firestore.Client() col_ref = client.collection("users") filter_1 = FieldFilter(u"birthYear", u"==", 1906) filter_2 = FieldFilter(u"birthYear", u"==", 1912) or_filter = Or(filters=[filter_1, filter_2]) docs = col_ref.where(filter=or_filter).stream() 

Metadata

Metadata

Assignees

Labels

api: firestoreIssues related to the googleapis/python-firestore API.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions