Skip to content
This repository was archived by the owner on Aug 30, 2026. It is now read-only.
This repository was archived by the owner on Aug 30, 2026. It is now read-only.

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

Closed

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()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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