Skip to main content
Using Deno in production at your company? Earn free Deno merch.
Give us feedback
Module

x/appwrite/src/services/database.ts>Database

[READ-ONLY] Official Appwrite Deno SDK 🦕
Go to Latest
class Database
extends Service
import { Database } from "https://deno.land/x/appwrite@0.0.2/src/services/database.ts";

Methods

createCollection(
name: string,
read: Array<any>,
write: Array<any>,
rules: Array<any>,
): Promise<string>

Create Collection

Create a new Collection.

createDocument(
collectionId: string,
read: Array<any>,
write: Array<any>,
parentDocument?: string,
parentProperty?: string,
parentPropertyType?: string,
): Promise<string>

Create Document

Create a new Document. Before using this route, you should create a new collection resource using either a server integration API or directly from your database console.

deleteCollection(collectionId: string): Promise<string>

Delete Collection

Delete a collection by its unique ID. Only users with write permissions have access to delete this resource.

deleteDocument(collectionId: string, documentId: string): Promise<string>

Delete Document

Delete document by its unique ID. This endpoint deletes only the parent documents, his attributes and relations to other documents. Child documents will not be deleted.

getCollection(collectionId: string): Promise<string>

Get Collection

Get collection by its unique ID. This endpoint response returns a JSON object with the collection metadata.

getCollectionLogs(collectionId: string): Promise<string>

Get Collection Logs

getDocument(collectionId: string, documentId: string): Promise<string>

Get Document

Get document by its unique ID. This endpoint response returns a JSON object with the document data.

listCollections(
search?: string,
limit?: number,
offset?: number,
orderType?: string,
): Promise<string>

List Collections

Get a list of all the user collections. You can use the query params to filter your results. On admin mode, this endpoint will return a list of all of the project collections. Learn more about different API modes.

listDocuments(
collectionId: string,
filters?: Array<any>,
offset?: number,
limit?: number,
orderField?: string,
orderType?: string,
orderCast?: string,
search?: string,
first?: number,
last?: number,
): Promise<string>

List Documents

Get a list of all the user documents. You can use the query params to filter your results. On admin mode, this endpoint will return a list of all of the project documents. Learn more about different API modes.

updateCollection(
collectionId: string,
name: string,
read: Array<any>,
write: Array<any>,
rules?: Array<any>,
): Promise<string>

Update Collection

Update collection by its unique ID.

updateDocument(
collectionId: string,
documentId: string,
read: Array<any>,
write: Array<any>,
): Promise<string>

Update Document