Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add equality and hash functions to DocumentReference to fix reference querying #68

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

etchao
Copy link

@etchao etchao commented Jan 17, 2023

Currently, querying documents by a reference field (e.g. .where("reference_field", "==", reference)) results in incorrect results due to document references not being compared properly. Even if there are documents with references that have the same path as the document reference passed into the query, no documents get returned.

To address this, I've implemented __eq__ and __hash__ to be more similar to the actual BaseDocumentReference implementations (see here and here). _client is included in the original implementation, but is not present in mocked base document. Therefore, I've opted to only hash / compare _path.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant