Skip to main content
Module

x/appwrite/mod.ts>Databases

[READ-ONLY] Official Appwrite Deno SDK 🦕
Go to Latest
class Databases
extends Service
Re-export
import { Databases } from "https://deno.land/x/appwrite@5.0.1/mod.ts";

Constructors

new
Databases(client: Client, databaseId: string)

Properties

protected
databaseId: string

Methods

create(name: string): Promise<Models.Database>

Create Database

createBooleanAttribute(
collectionId: string,
key: string,
required: boolean,
xdefault?: boolean,
array?: boolean,
): Promise<Models.AttributeBoolean>

Create Boolean Attribute

createCollection(
collectionId: string,
name: string,
permission: string,
read: string[],
write: string[],
): Promise<Models.Collection>

Create Collection

createDocument<Document extends Models.Document>(
collectionId: string,
documentId: string,
data: object,
read?: string[],
write?: string[],
): Promise<Document>

Create Document

createEmailAttribute(
collectionId: string,
key: string,
required: boolean,
xdefault?: string,
array?: boolean,
): Promise<Models.AttributeEmail>

Create Email Attribute

createEnumAttribute(
collectionId: string,
key: string,
elements: string[],
required: boolean,
xdefault?: string,
array?: boolean,
): Promise<Models.AttributeEnum>

Create Enum Attribute

createFloatAttribute(
collectionId: string,
key: string,
required: boolean,
min?: number,
max?: number,
xdefault?: number,
array?: boolean,
): Promise<Models.AttributeFloat>

Create Float Attribute

createIndex(
collectionId: string,
key: string,
type: string,
attributes: string[],
orders?: string[],
): Promise<Models.Index>

Create Index

createIntegerAttribute(
collectionId: string,
key: string,
required: boolean,
min?: number,
max?: number,
xdefault?: number,
array?: boolean,
): Promise<Models.AttributeInteger>

Create Integer Attribute

createIpAttribute(
collectionId: string,
key: string,
required: boolean,
xdefault?: string,
array?: boolean,
): Promise<Models.AttributeIp>

Create IP Address Attribute

createStringAttribute(
collectionId: string,
key: string,
size: number,
required: boolean,
xdefault?: string,
array?: boolean,
): Promise<Models.AttributeString>

Create String Attribute

createUrlAttribute(
collectionId: string,
key: string,
required: boolean,
xdefault?: string,
array?: boolean,
): Promise<Models.AttributeUrl>

Create URL Attribute

delete(): Promise<Response>

Delete Database

deleteAttribute(collectionId: string, key: string): Promise<Response>

Delete Attribute

deleteCollection(collectionId: string): Promise<Response>

Delete Collection

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

Delete Document

deleteIndex(collectionId: string, key: string): Promise<Response>

Delete Index

Get Database

getAttribute(collectionId: string, key: string): Promise<Response>

Get Attribute

getCollection(collectionId: string): Promise<Models.Collection>

Get Collection

getDatabaseId(): string
getDocument<Document extends Models.Document>(collectionId: string, documentId: string): Promise<Document>

Get Document

getIndex(collectionId: string, key: string): Promise<Models.Index>

Get Index

list(
search?: string,
limit?: number,
offset?: number,
cursor?: string,
cursorDirection?: string,
orderType?: string,
): Promise<Models.DatabaseList>

List Databases

listAttributes(collectionId: string): Promise<Models.AttributeList>

List Attributes

listCollections(
search?: string,
limit?: number,
offset?: number,
cursor?: string,
cursorDirection?: string,
orderType?: string,
): Promise<Models.CollectionList>

List Collections

listDocuments<Document extends Models.Document>(
collectionId: string,
queries?: string[],
limit?: number,
offset?: number,
cursor?: string,
cursorDirection?: string,
orderAttributes?: string[],
orderTypes?: string[],
): Promise<Models.DocumentList<Document>>

List Documents

listIndexes(collectionId: string): Promise<Models.IndexList>

List Indexes

setDatabaseId(databaseId: string): void
update(name: string): Promise<Models.Collection>

Update Database

updateCollection(
collectionId: string,
name: string,
permission: string,
read?: string[],
write?: string[],
enabled?: boolean,
): Promise<Models.Collection>

Update Collection

updateDocument<Document extends Models.Document>(
collectionId: string,
documentId: string,
data?: object,
read?: string[],
write?: string[],
): Promise<Document>

Update Document