Deleting all documents in collection
ybirader opened this issue · comments
Description
I understand that Typesense does not currently support truncating a collection.
Would the following delete all documents in a collection?
client.collections('test').documents().delete({ filter_by: 'id>=0' })
An alternative could be to simply delete the collection and recreate it:
const schema = await client.collections(indexName).retrieve();
await client.collections(indexName).delete();
return client.collections().create(schema);
If there is an alternative way to accomplish this, please let me know.
Would the following delete all documents in a collection?
client.collections('test').documents().delete({ filter_by: 'id>=0' })
No, since id
is a string field.
An alternative could be to simply delete the collection and recreate it
This is indeed the workaround for now.
We're tracking the truncation feature request here - Duplicate of #1016
Could you thumbs up it?