import { Collection } from "https://deno.land/x/kvdex@v0.29.0/mod.ts";
Constructors
Properties
Methods
Set a document entry in the KV store.
Update a document entry with new data.
Adds a new document to the KV store with a generated id.
Does not overwrite existing documents with coliiding id.
Adds multiple documents to the KV store with generated ids.
Counts the number of documents in the collection by a secondary index.
Delete a document by a primary index.
Delete documents by a secondary index. The method takes an optional options argument that can be used for filtering of documents, and pagination.
Deletes multiple documents from the KV store according to the given options.
If no options are given, all documents are deleted.
Add data to the collection queue to be delivered to the queue listener
via db.collection.listenQueue()
. The data will only be received by queue
listeners on the specified collection and topic. The method takes an optional options
argument that can be used to set a delivery delay and topic.
Find a document by a primary index.
Find documents by a secondary index. Secondary indices are not unique, and therefore the result is an array of documents. The method takes an optional options argument that can be used for filtering of documents, and pagination.
Retrieve the version history of a document by id.
A history entry contains a timestamp, type of either "write" or "delete", and a copy of the document value if the type is "write".
Finds multiple documents with the given array of ids in the KV store.
Find an undelivered document entry by id from the collection queue.
Executes a callback function for every document according to the given options.
If no options are given, the callback function is executed for all documents in the collection.
Executes a callback function for every document by a secondary index and according to the given options.
If no options are given, the callback function is executed for all documents matching the index.
Retrieves multiple documents from the KV store according to the given options.
If no options are given, all documents are retrieved.
Listen for data from the collection queue that was enqueued with db.collection.enqueue()
.
Will only receive data that was enqueued to the specific collection queue.
Takes a handler function as argument.
Executes a callback function for every document according to the given options.
If no options are given, the callback function is executed for all documents in the collection.
The results from the callback function are returned as a list.
Executes a callback function for every document by a secondary index and according to the given options.
If no options are given, the callback function is executed for all documents matching the index.
The results from the callback function are returned as a list.
Adds a new document with the given id to the KV store.
Does not overwrite existing documents with coliiding id.
Updates a document with the given id in the KV store.
By default, the merge
strategy is used when available, falling back to
replace
for primitive types and built-in objects (Date, RegExp, etc.).
For plain objects, the merge-shallow
strategy is also supported.
Update a document by a primary index.
Update documents in the collection by a secondary index.
Update the value of multiple existing documents in the collection.
Update an existing document by either id or primary index, or set a new document entry if no document with matching id/index exists.
When upserting by primary index, an id can be optionally specified which will be used when setting a new document entry, otherwise an id will be generated.
Write a document to the KV store.
Sets a new document entry if no matching id already exists, overwrites the exisiting entry if it exists.
Does not overwrite existing entries if there is a primary index collision.