CouchbaseVectorGet
Retrieve a vector document by its ID.
Syntax
couchbaseVectorGet(cacheName, id)Parameters
cacheName
String
Yes
Name of the cache configuration
id
String
Yes
Document ID to retrieve
Returns
Returns a struct containing the vector document:
id- Document IDtype- Document type ("vector_document")text- Text contentembedding- Vector embedding arraymetadata- Custom metadata structuserId- User ID (if set)conversationId- Conversation ID (if set)createdAt- Creation timestampupdatedAt- Last update timestamp
Returns an empty struct {} if document not found.
Examples
Basic Retrieval
Check if Exists
Get with Metadata
Get User Document
Verify Before Update
Get Conversation Context
Retrieve Multiple Documents
Validate Document Structure
Export Document
Notes
Empty struct returned - If document doesn't exist, returns
{}instead of throwing errorCheck existence - Use
doc.isEmpty()orstructKeyExists(doc, "id")to checkJava HashMap - Document is returned as HashMap (BoxLang is fully Java interop compatible)
No caching - Always fetches fresh data from Couchbase
Case sensitivity - Document IDs are case-sensitive
Error Handling
Related Functions
couchbaseVectorAdd - Store vector document
couchbaseVectorSearch - Search by similarity
couchbaseVectorDelete - Delete vector document
couchbaseVectorList - List vector documents
See Also
Last updated
Was this helpful?
