TopK documents are JSON-like objects containing key-value pairs.
To upsert documents, pass a list of documents to the upsert()
function:
_id
field._id
doesn’t exist, a new document will be inserted._id
already exists, the existing document will be replaced with the new one.The upsert()
function does not perform a partial update or merge - the entire document is being replaced.
TopK documents are a flat structure of key-value pairs.
The following value types are supported:
Type | Python Type | JavaScript Type | Helper Function |
---|---|---|---|
String | str | string | - |
Integer | int | number | - |
Float | float | number | - |
Boolean | bool | boolean | - |
F32 vector | List[float] | number[] | f32_vector() |
U8 vector | use helper | use helper | u8_vector() |
Binary vector | use helper | use helper | binary_vector() |
F32 sparse vector | use helper | use helper | f32_sparse_vector() |
U8 sparse vector | use helper | use helper | u8_sparse_vector() |
Bytes | use helper | use helper | bytes() |
Here’s an example of a creating a collection with all supported types and inserting a document:
Insert a document with all supported types:
See the Helper functions page for details on how to use vector and bytes helper functions in TopK.
TopK documents are JSON-like objects containing key-value pairs.
To upsert documents, pass a list of documents to the upsert()
function:
_id
field._id
doesn’t exist, a new document will be inserted._id
already exists, the existing document will be replaced with the new one.The upsert()
function does not perform a partial update or merge - the entire document is being replaced.
TopK documents are a flat structure of key-value pairs.
The following value types are supported:
Type | Python Type | JavaScript Type | Helper Function |
---|---|---|---|
String | str | string | - |
Integer | int | number | - |
Float | float | number | - |
Boolean | bool | boolean | - |
F32 vector | List[float] | number[] | f32_vector() |
U8 vector | use helper | use helper | u8_vector() |
Binary vector | use helper | use helper | binary_vector() |
F32 sparse vector | use helper | use helper | f32_sparse_vector() |
U8 sparse vector | use helper | use helper | u8_sparse_vector() |
Bytes | use helper | use helper | bytes() |
Here’s an example of a creating a collection with all supported types and inserting a document:
Insert a document with all supported types:
See the Helper functions page for details on how to use vector and bytes helper functions in TopK.