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

Use enums for MongoDB query selectors and update operators #466

Open
taesungh opened this issue Dec 10, 2024 · 1 comment
Open

Use enums for MongoDB query selectors and update operators #466

taesungh opened this issue Dec 10, 2024 · 1 comment

Comments

@taesungh
Copy link
Member

Made a mistake in #429: the database query for checking if a user already applied should use $exists as a selector instead of "exists" as a key.

Collection.USERS, {"_id": user.uid, "roles": {"exists": True}}, ["roles"]

To help avoid a mistake like this in the future, we can define our own str-like Enum in mongodb_handler.py that has named references for the Query Selectors we use (including $in) to help enforce this as a pattern. This should also be done for the Update Operators we use, e.g. $set.

@taesungh
Copy link
Member Author

Hot-fix for typo added in #483, would still be good to add this at some point.

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

No branches or pull requests

1 participant