-
Notifications
You must be signed in to change notification settings - Fork 22
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
Mongodb collection drop function #225
Mongodb collection drop function #225
Conversation
astrapy/idiomatic/collection.py
Outdated
@@ -216,6 +216,9 @@ def delete_many( | |||
f"(gotten '${json.dumps(dm_response)}')" | |||
) | |||
|
|||
def drop(self, name_or_collection: Union[str, AsyncCollection]) -> None: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As a method on "collection", it has no "name_or_collection" argument (see ref), it being implied that the one to drop is self.
note: The Mongo docs use the term "alias" pretty liberally here IMO :D
astrapy/idiomatic/collection.py
Outdated
@@ -445,6 +448,10 @@ async def delete_many( | |||
f"(gotten '${json.dumps(dm_response)}')" | |||
) | |||
|
|||
async def drop(self, name_or_collection: Union[str, AsyncCollection]) -> None: | |||
return await self._astra_db_collection.astra_db.delete_collection(name_or_collection) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
same for the async, and incidentally I am surprised if this typechecks ...
Can you confirm this is subsumed by #231 (as it seems to me?) In that case, please close. |
Adding a function for a collection to drop itself: collection.drop(COLLECTION_NAME).
Added a test to validate that it's working. It seems like a ddl sort of thing so that's where I put it.