Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
```javascript
import { Client, DocumentsDB, Permission, Role } from "@appwrite.io/console";

const client = new Client()
.setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint
.setProject('<YOUR_PROJECT_ID>'); // Your project ID

const documentsDB = new DocumentsDB(client);

const result = await documentsDB.createCollection({
databaseId: '<DATABASE_ID>',
collectionId: '<COLLECTION_ID>',
name: '<NAME>',
permissions: [Permission.read(Role.any())], // optional
documentSecurity: false, // optional
enabled: false, // optional
attributes: [], // optional
indexes: [] // optional
});

console.log(result);
```
25 changes: 25 additions & 0 deletions examples/1.9.x/console-web/examples/documentsdb/create-document.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
```javascript
import { Client, DocumentsDB, Permission, Role } from "@appwrite.io/console";

const client = new Client()
.setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint
.setProject('<YOUR_PROJECT_ID>'); // Your project ID

const documentsDB = new DocumentsDB(client);

const result = await documentsDB.createDocument({
databaseId: '<DATABASE_ID>',
collectionId: '<COLLECTION_ID>',
documentId: '<DOCUMENT_ID>',
data: {
"username": "walter.obrien",
"email": "walter.obrien@example.com",
"fullName": "Walter O'Brien",
"age": 30,
"isAdmin": false
},
permissions: [Permission.read(Role.any())] // optional
});

console.log(result);
```
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
```javascript
import { Client, DocumentsDB } from "@appwrite.io/console";

const client = new Client()
.setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint
.setProject('<YOUR_PROJECT_ID>'); // Your project ID

const documentsDB = new DocumentsDB(client);

const result = await documentsDB.createDocuments({
databaseId: '<DATABASE_ID>',
collectionId: '<COLLECTION_ID>',
documents: []
});

console.log(result);
```
21 changes: 21 additions & 0 deletions examples/1.9.x/console-web/examples/documentsdb/create-index.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
```javascript
import { Client, DocumentsDB, DocumentsDBIndexType, OrderBy } from "@appwrite.io/console";

const client = new Client()
.setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint
.setProject('<YOUR_PROJECT_ID>'); // Your project ID

const documentsDB = new DocumentsDB(client);

const result = await documentsDB.createIndex({
databaseId: '<DATABASE_ID>',
collectionId: '<COLLECTION_ID>',
key: '',
type: DocumentsDBIndexType.Key,
attributes: [],
orders: [OrderBy.Asc], // optional
lengths: [] // optional
});

console.log(result);
```
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
```javascript
import { Client, DocumentsDB } from "@appwrite.io/console";

const client = new Client()
.setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint
.setProject('<YOUR_PROJECT_ID>'); // Your project ID

const documentsDB = new DocumentsDB(client);

const result = await documentsDB.createTransaction({
ttl: 60 // optional
});

console.log(result);
```
17 changes: 17 additions & 0 deletions examples/1.9.x/console-web/examples/documentsdb/create.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
```javascript
import { Client, DocumentsDB } from "@appwrite.io/console";

const client = new Client()
.setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint
.setProject('<YOUR_PROJECT_ID>'); // Your project ID

const documentsDB = new DocumentsDB(client);

const result = await documentsDB.create({
databaseId: '<DATABASE_ID>',
name: '<NAME>',
enabled: false // optional
});

console.log(result);
```
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
```javascript
import { Client, DocumentsDB } from "@appwrite.io/console";

const client = new Client()
.setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint
.setProject('<YOUR_PROJECT_ID>'); // Your project ID

const documentsDB = new DocumentsDB(client);

const result = await documentsDB.decrementDocumentAttribute({
databaseId: '<DATABASE_ID>',
collectionId: '<COLLECTION_ID>',
documentId: '<DOCUMENT_ID>',
attribute: '',
value: null, // optional
min: null, // optional
transactionId: '<TRANSACTION_ID>' // optional
});

console.log(result);
```
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
```javascript
import { Client, DocumentsDB } from "@appwrite.io/console";

const client = new Client()
.setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint
.setProject('<YOUR_PROJECT_ID>'); // Your project ID

const documentsDB = new DocumentsDB(client);

const result = await documentsDB.deleteCollection({
databaseId: '<DATABASE_ID>',
collectionId: '<COLLECTION_ID>'
});

console.log(result);
```
18 changes: 18 additions & 0 deletions examples/1.9.x/console-web/examples/documentsdb/delete-document.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
```javascript
import { Client, DocumentsDB } from "@appwrite.io/console";

const client = new Client()
.setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint
.setProject('<YOUR_PROJECT_ID>'); // Your project ID

const documentsDB = new DocumentsDB(client);

const result = await documentsDB.deleteDocument({
databaseId: '<DATABASE_ID>',
collectionId: '<COLLECTION_ID>',
documentId: '<DOCUMENT_ID>',
transactionId: '<TRANSACTION_ID>' // optional
});

console.log(result);
```
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
```javascript
import { Client, DocumentsDB } from "@appwrite.io/console";

const client = new Client()
.setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint
.setProject('<YOUR_PROJECT_ID>'); // Your project ID

const documentsDB = new DocumentsDB(client);

const result = await documentsDB.deleteDocuments({
databaseId: '<DATABASE_ID>',
collectionId: '<COLLECTION_ID>',
queries: [], // optional
transactionId: '<TRANSACTION_ID>' // optional
});

console.log(result);
```
17 changes: 17 additions & 0 deletions examples/1.9.x/console-web/examples/documentsdb/delete-index.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
```javascript
import { Client, DocumentsDB } from "@appwrite.io/console";

const client = new Client()
.setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint
.setProject('<YOUR_PROJECT_ID>'); // Your project ID

const documentsDB = new DocumentsDB(client);

const result = await documentsDB.deleteIndex({
databaseId: '<DATABASE_ID>',
collectionId: '<COLLECTION_ID>',
key: ''
});

console.log(result);
```
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
```javascript
import { Client, DocumentsDB } from "@appwrite.io/console";

const client = new Client()
.setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint
.setProject('<YOUR_PROJECT_ID>'); // Your project ID

const documentsDB = new DocumentsDB(client);

const result = await documentsDB.deleteTransaction({
transactionId: '<TRANSACTION_ID>'
});

console.log(result);
```
15 changes: 15 additions & 0 deletions examples/1.9.x/console-web/examples/documentsdb/delete.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
```javascript
import { Client, DocumentsDB } from "@appwrite.io/console";

const client = new Client()
.setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint
.setProject('<YOUR_PROJECT_ID>'); // Your project ID

const documentsDB = new DocumentsDB(client);

const result = await documentsDB.delete({
databaseId: '<DATABASE_ID>'
});

console.log(result);
```
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
```javascript
import { Client, DocumentsDB, UsageRange } from "@appwrite.io/console";

const client = new Client()
.setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint
.setProject('<YOUR_PROJECT_ID>'); // Your project ID

const documentsDB = new DocumentsDB(client);

const result = await documentsDB.getCollectionUsage({
databaseId: '<DATABASE_ID>',
collectionId: '<COLLECTION_ID>',
range: UsageRange.TwentyFourHours // optional
});

console.log(result);
```
16 changes: 16 additions & 0 deletions examples/1.9.x/console-web/examples/documentsdb/get-collection.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
```javascript
import { Client, DocumentsDB } from "@appwrite.io/console";

const client = new Client()
.setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint
.setProject('<YOUR_PROJECT_ID>'); // Your project ID

const documentsDB = new DocumentsDB(client);

const result = await documentsDB.getCollection({
databaseId: '<DATABASE_ID>',
collectionId: '<COLLECTION_ID>'
});

console.log(result);
```
19 changes: 19 additions & 0 deletions examples/1.9.x/console-web/examples/documentsdb/get-document.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
```javascript
import { Client, DocumentsDB } from "@appwrite.io/console";

const client = new Client()
.setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint
.setProject('<YOUR_PROJECT_ID>'); // Your project ID

const documentsDB = new DocumentsDB(client);

const result = await documentsDB.getDocument({
databaseId: '<DATABASE_ID>',
collectionId: '<COLLECTION_ID>',
documentId: '<DOCUMENT_ID>',
queries: [], // optional
transactionId: '<TRANSACTION_ID>' // optional
});

console.log(result);
```
17 changes: 17 additions & 0 deletions examples/1.9.x/console-web/examples/documentsdb/get-index.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
```javascript
import { Client, DocumentsDB } from "@appwrite.io/console";

const client = new Client()
.setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint
.setProject('<YOUR_PROJECT_ID>'); // Your project ID

const documentsDB = new DocumentsDB(client);

const result = await documentsDB.getIndex({
databaseId: '<DATABASE_ID>',
collectionId: '<COLLECTION_ID>',
key: ''
});

console.log(result);
```
15 changes: 15 additions & 0 deletions examples/1.9.x/console-web/examples/documentsdb/get-transaction.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
```javascript
import { Client, DocumentsDB } from "@appwrite.io/console";

const client = new Client()
.setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint
.setProject('<YOUR_PROJECT_ID>'); // Your project ID

const documentsDB = new DocumentsDB(client);

const result = await documentsDB.getTransaction({
transactionId: '<TRANSACTION_ID>'
});

console.log(result);
```
16 changes: 16 additions & 0 deletions examples/1.9.x/console-web/examples/documentsdb/get-usage.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
```javascript
import { Client, DocumentsDB, UsageRange } from "@appwrite.io/console";

const client = new Client()
.setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint
.setProject('<YOUR_PROJECT_ID>'); // Your project ID

const documentsDB = new DocumentsDB(client);

const result = await documentsDB.getUsage({
databaseId: '<DATABASE_ID>',
range: UsageRange.TwentyFourHours // optional
});

console.log(result);
```
15 changes: 15 additions & 0 deletions examples/1.9.x/console-web/examples/documentsdb/get.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
```javascript
import { Client, DocumentsDB } from "@appwrite.io/console";

const client = new Client()
.setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint
.setProject('<YOUR_PROJECT_ID>'); // Your project ID

const documentsDB = new DocumentsDB(client);

const result = await documentsDB.get({
databaseId: '<DATABASE_ID>'
});

console.log(result);
```
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
```javascript
import { Client, DocumentsDB } from "@appwrite.io/console";

const client = new Client()
.setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint
.setProject('<YOUR_PROJECT_ID>'); // Your project ID

const documentsDB = new DocumentsDB(client);

const result = await documentsDB.incrementDocumentAttribute({
databaseId: '<DATABASE_ID>',
collectionId: '<COLLECTION_ID>',
documentId: '<DOCUMENT_ID>',
attribute: '',
value: null, // optional
max: null, // optional
transactionId: '<TRANSACTION_ID>' // optional
});

console.log(result);
```
Loading
Loading