Docs
Skip to content

VectorsDB

Documents_

Create, read, update, and delete documents in Appwrite VectorsDB. Learn how to store embedding vectors and metadata in your collections.

3 min read

Raw

Each piece of data in Appwrite VectorsDB is a document. A document's data follows the fixed schema provisioned by its collection: an embeddings vector and an optional metadata object.

An embedding is a list of numbers that represents the meaning of a piece of content, so similar content gets similar numbers. You can bring your own vectors or generate embeddings from text with Appwrite's built-in models.

The embeddings array is required, and its length must equal the dimension you set when creating the collection. The metadata field is free-form JSON, so you can attach any data you want to keep alongside each vector.

Create documents

Use the createDocument method to add a document to a collection. Appwrite Server SDKs require an API key.

To insert many documents in a single request, use bulk operations instead of calling createDocument in a loop.

Get document

Use the getDocument method to read a single document by its ID.

List documents

Use the listDocuments method to read documents from a collection. Pass queries to filter, order, and paginate the results.

To rank documents by similarity to a query vector, use a vector search query instead. See Vector search.

listDocuments sends queries in the URL. When your queries are too long for that, createQuery takes the same arguments in the request body and returns the same document list. See Send queries in the request body.

Update document

Use the updateDocument method to update a document. The update is a patch, so you only pass the fields you want to change. To change the vector, pass a new embeddings array of the same length as the collection's dimension.

Upsert document

Use the upsertDocument method to create a document if it doesn't exist, or update it if it does.

Delete document

Use the deleteDocument method to remove a document from a collection.

Permissions

To access documents through a Client SDK, you must grant the relevant permissions. By default, Appwrite doesn't grant any user permissions when a new collection is created.

You can configure permissions at the collection level, or enable documentSecurity on the collection to also set permissions on individual documents.

Learn about configuring permissions.

Next steps

Continue learning with these related guides:

Was this page helpful?

Share what worked or what we should fix. Once approved, our agents automatically apply suggested updates to the docs.