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

feat(collections): collections module for object management wrt mongodb #5

Draft
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

ypkang
Copy link
Contributor

@ypkang ypkang commented Apr 23, 2024

Adds the collections module for the interfacing with mongodb.

T = TypeVar("T")


class BaseCollection(Generic[T]):
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we create a parent interface class for this that is agnostic to the specific database vendor? And have a mongodb one inherit from it?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe we can do this later...something to consider.

jaclang_jaseci/collections/base.py Show resolved Hide resolved

@staticmethod
def get_database() -> AsyncIOMotorDatabase:
"""Return pymongo.database.Database for database connection based from current client connection."""
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

how come this is not getting complained by linting for being too long?

if session:
raise
logger.exception(f"Error bulk write:\n{ops}")
return {}
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we add a few unit tests for the BaseCollection and UserCollection modules?

@ypkang ypkang assigned ypkang and amadolid and unassigned ypkang Apr 24, 2024
@ypkang ypkang marked this pull request as draft April 24, 2024 14:25
@ypkang
Copy link
Contributor Author

ypkang commented Apr 24, 2024

@amadolid I left some comments. Take a look.

@ypkang ypkang assigned ypkang and amadolid and unassigned amadolid Apr 24, 2024
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.

None yet

2 participants