Hi there! Are you looking for the official Deno documentation? Try docs.deno.com for all your Deno learning needs.

Collection

import { Collection } from "https://7smzlzo4lz2ivy7dcfbyll4asdkqtc62pbdit23ysj5xdlu6wsra.arweave.net/_JmV5dxedIrj4xFDha-AkNUJi9p4RonreJJ7ca6etKI/src/collection.ts";

A Collection to store data

class Collection<T extends Document = Document> {
constructor(name: string, collectionOptions: CollectionOptions);
private autosave: boolean;
private data: T[];
private fsPath: string;
 
deleteMany(options: T);
deleteOne(options: T);
find(options: T);
findOne(options: T);
insertMany(els: T[]);
insertOne(el: T);
save();
updateMany(options: T, el: T);
updateOne(options: T, el: T);
}

§Type Parameters

§Constructors

§
new Collection(name: string, collectionOptions: CollectionOptions)
[src]

Ensure the collection file is existed. Read the initial data from the file if the file existed.

@param name

the Collection name

@param collectionOptions

§Properties

§
autosave: boolean
[src]
§
data: T[]
[src]
§
fsPath: string
[src]

§Methods

§
deleteMany(options: T)
[src]

Bulk delete

@param options

Filter conditions of documents

@return

the deleted document IDs

§
deleteOne(options: T)
[src]

Delete a document

@param options

Filter conditions of documents

@return

the deleted document ID

§
find(options: T)
[src]

Find some documents by using filter conditions

Caution! The method on this stage is only able to find documents with equals properties. For more options like greater than, less than or equal to, please wait for newer version

@param options

filter conditions

@return

the filtered documents

§
findOne(options: T)
[src]
§
insertMany(els: T[])
[src]

Bulk Insert

@param els

an array of documents to be inserted

@return

the inserted documents

§
insertOne(el: T)
[src]

Insert a document

@param el

the document to be inserted

@return

the inserted document

§
save()
[src]

Save a copy of the data snapshot at this point to the file.

§
updateMany(options: T, el: T)
[src]

Bulk Update

@param options

filter condition of documents

@param el

the updated document attributes

@return

the updated documents

§
updateOne(options: T, el: T)
[src]

Update a document

@param options

filter condition of documents

@param el

the updated document attributes

@return

the updated document