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

Delete collection #45

Open
croffler opened this issue Jul 22, 2023 · 2 comments
Open

Delete collection #45

croffler opened this issue Jul 22, 2023 · 2 comments

Comments

@croffler
Copy link

croffler commented Jul 22, 2023

Description

Drop collection does not seem to completely remove the collection.

Steps to reproduce

   CollectionResponse[] collectionResponses = client.getTypesenseClient().collections().retrieve();
for (CollectionResponse c : collectionResponses) {
	client.getTypesenseClient().collections(c.getName()).delete();
}
Collection collection = client.getTypesenseClient().collections("service");
		
if ( collection == null){
	// create the schema
}
else {
	CollectionResponse retrieve = collection.retrieve();
      // throws exception
}

Expected Behavior

Deleting an collection should drop the collection

Actual Behavior

After deleting a collection, the collection is not null, but when accessing it an exception is thrown

Metadata

Typesense Version: 0.24.1

OS:MacOs

@stargazer33
Copy link
Contributor

stargazer33 commented Aug 13, 2024

I just reproduced exactly this thing!
The collection is NOT DELETED
OS: Ubuntu
Typesense version: 0.26

UPDATE: This "delete bug" is not easy to reproduce.I saw it trying to delete and than immediately to create collection with the same name. All in Java code, with Typesense Java API.

I have to say, I did A LOT of upserts into this collection before, during several days (experimented with Typesense over a week, importing almost the same documents many times, with slightly different schemas)

Now I changed the collection name -to be able to continue- and... looks like this bug is gone.
There was no upserts/inserts into this new collection, and multiple delete collection+create worked

@kishorenc
Copy link
Member

I will leave this issue open, but just want to add a note that:

client.collections("Countries").retrieve();

will NOT return null value when the collection is not found. It will throw an ObjectNotFound exception. So atleast for the original issue, checking for null is wrong.

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

3 participants