Class: Collection#
Collection.Collection
Properties#
id#
• id: string
metadata#
• metadata: CollectionMetadata
name#
• name: string
Methods#
add#
â–¸ add(params
): Promise
<void
>
Add items to the collection
Parameters#
Name | Type | Description |
---|---|---|
params | AddRecordsParams | The parameters for the query. |
Returns#
Promise
<void
>
- The response from the API. True if successful.
Example
count#
â–¸ count(): Promise
<number
>
Count the number of items in the collection
Returns#
Promise
<number
>
- The number of items in the collection.
Example
delete#
â–¸ delete(params?
): Promise
<string
[]>
Deletes items from the collection.
Parameters#
Name | Type | Description |
---|---|---|
params | DeleteParams | The parameters for deleting items from the collection. |
Returns#
Promise
<string
[]>
A promise that resolves to the IDs of the deleted items.
Throws
If there is an issue deleting items from the collection.
Example
get#
â–¸ get(params?
): Promise
<MultiGetResponse
>
Get items from the collection
Parameters#
Name | Type | Description |
---|---|---|
params | BaseGetParams | The parameters for the query. |
Returns#
Promise
<MultiGetResponse
>
- The response from the server.
Example
modify#
â–¸ modify(params
): Promise
<CollectionParams
>
Modify the collection name or metadata
Parameters#
Name | Type | Description |
---|---|---|
params | Object | The parameters for the query. |
params.metadata? | CollectionMetadata | Optional new metadata for the collection. |
params.name? | string | Optional new name for the collection. |
Returns#
Promise
<CollectionParams
>
- The response from the API.
Example
peek#
â–¸ peek(params?
): Promise
<MultiGetResponse
>
Peek inside the collection
Parameters#
Name | Type | Description |
---|---|---|
params | PeekParams | The parameters for the query. |
Returns#
Promise
<MultiGetResponse
>
A promise that resolves to the query results.
Throws
If there is an issue executing the query.
Example
query#
â–¸ query(params
): Promise
<MultiQueryResponse
>
Performs a query on the collection using the specified parameters.
Parameters#
Name | Type | Description |
---|---|---|
params | QueryRecordsParams | The parameters for the query. |
Returns#
Promise
<MultiQueryResponse
>
A promise that resolves to the query results.
Throws
If there is an issue executing the query.
Example
Example
update#
â–¸ update(params
): Promise
<void
>
Update items in the collection
Parameters#
Name | Type | Description |
---|---|---|
params | UpdateRecordsParams | The parameters for the query. |
Returns#
Promise
<void
>
Example
upsert#
â–¸ upsert(params
): Promise
<void
>
Upsert items to the collection
Parameters#
Name | Type | Description |
---|---|---|
params | AddRecordsParams | The parameters for the query. |
Returns#
Promise
<void
>
Example