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

[Potential bug] Inconsistent query() input for MongoDbDatabase and TinyDbJson #8

Open
hlmore opened this issue Oct 8, 2024 · 0 comments

Comments

@hlmore
Copy link
Collaborator

hlmore commented Oct 8, 2024

Beaverdam originally handled only MongoDB as a database backend, so MongoDbDatabase.query() was designed to correspond nicely to the pymongo's .find() function. Since then, TinyDB has also been added as a possible database backend, but because its .search() function has a different structure, TinyDbJson.query() has slightly different input.

At the moment, this results in some slightly un-beautiful code where MongoDbDatabase.query() accepts either a dict, strings, or a list of strings as query_output, and TinyDbJson.query() only accepts a string or list of strings.

In practice, this isn't currently a concern, because we aren't using any of the more advanced output functions.

In future, to handle more complex queries, a unified set of inputs to MetadataSource.query() should be chosen, and then these inputs should be appropriately parsed in the subclass functions MongoDbDatabase.query() and TinyDbJson.query() (and whichever other backends will be used).

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