Overview
TheCollection class is the primary interface for interacting with your data in Zvec. It provides methods for:
- Data Manipulation (DML): Insert, update, upsert, and delete documents
- Data Querying (DQL): Vector similarity search, filtering, and document retrieval
- Schema Management (DDL): Create indices, add/drop columns, optimize collections
Collection instance is obtained via zvec.create_and_open() or zvec.open() — you should never instantiate it directly.
Creating a Collection
Available Methods
Data Manipulation
insert()
Add new documents to the collection
update()
Modify existing documents by ID
upsert()
Insert or update documents
delete()
Remove documents by ID or filter
Data Querying
query()
Perform vector similarity search
fetch()
Retrieve documents by ID
Schema Management
create_index()
Build indices on vector or scalar fields
add_column()
Add a new field to the schema
alter_column()
Rename or modify existing columns
optimize()
Merge segments and rebuild indices
Properties
The filesystem path where the collection is stored.
The schema defining the structure of the collection.
The options used to open the collection.
Runtime statistics about the collection (e.g., document count, size).