You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Sep 29, 2023. It is now read-only.
Copy file name to clipboardExpand all lines: app/views/docs/databases.phtml
+51-52Lines changed: 51 additions & 52 deletions
Original file line number
Diff line number
Diff line change
@@ -1,8 +1,7 @@
1
1
<p>
2
2
The Databases Service allows you to store your application and users' data and fetch it using different supported queries.
3
-
Using your Appwrite Databases, you can create multiple databases, organize your data into collections and documents using the Appwrite REST API. You can also use the Appwrite <a href="/docs/realtime">Realtime API</a> to subscribe to live changes in your collections and documents.
4
-
In addition, the Databases Service provides built-in validation to check the integrity of your incoming data, custom indexing for query performance,
5
-
as well as a flexible permissions mechanism to allow you to easily segment data between different users, teams, and roles.
3
+
Using the Databases Service, you can create multiple databases and organize your data into collections and documents using Appwrite's REST API. You can also use the Appwrite <a href="/docs/realtime">Realtime API</a> to subscribe to live changes in your collections and documents.
4
+
In addition, the Databases Service provides built-in validation to check the integrity of your incoming data, custom indexing for query performance, and a flexible permissions mechanism to easily segment data between different users, teams, and roles.
6
5
</p>
7
6
8
7
<h2><a href="/docs/databases#databases" id="databases">Create Your Databases</a></h2>
Appwrite provides permissions to restrict access to documents at two levels, document and collection level. When a user has the appropriate type of <a href="/docs/permissions/">access permissions</a> granted at <b>either</b> the document or the collection level, they will be able to access or change the document. If the permission field is left empty, Client SDKs cannot access the document.
35
+
Appwrite provides permissions to restrict access to documents at two levels, document and collection level. When a user has the appropriate <a href="/docs/permissions/">permission type</a> granted at <b>either</b> the document or the collection level, they will be able to access or change the document. If the permission field is left empty, Client SDKs cannot access the document.
37
36
</p>
38
37
39
38
<h4>Document Level Permissions</h4>
@@ -55,46 +54,46 @@
55
54
</thead>
56
55
<tbody>
57
56
<tr>
58
-
<td>string</td>
57
+
<td><code>string</code></td>
59
58
<td>String attribute.</td>
60
59
</tr>
61
60
<tr>
62
-
<td>integer</td>
61
+
<td><code>integer</code></td>
63
62
<td>Integer attribute.</td>
64
63
</tr>
65
64
<tr>
66
-
<td>float</td>
65
+
<td><code>float</code></td>
67
66
<td>Float attribute.</td>
68
67
</tr>
69
68
<tr>
70
-
<td>boolean</td>
69
+
<td><code>boolean</code></td>
71
70
<td>Boolean attribute.</td>
72
71
</tr>
73
72
<tr>
74
-
<td>enum</td>
73
+
<td><code>enum</code></td>
75
74
<td>Enum attribute.</td>
76
75
</tr>
77
76
<tr>
78
-
<td>ip</td>
77
+
<td><code>ip</code></td>
79
78
<td>IP address attribute for IPv4 and IPv6.</td>
80
79
</tr>
81
80
<tr>
82
-
<td>email</td>
81
+
<td><code>email</code></td>
83
82
<td>Email address attribute.</td>
84
83
</tr>
85
84
<tr>
86
-
<td>url</td>
85
+
<td><code>url</code></td>
87
86
<td>URL attribute.</td>
88
87
</tr>
89
88
</tbody>
90
89
</table>
91
90
92
91
<p>
93
-
If an attribute must be present in all documents, set it as <span class="tag">required</span>. If not, a <span class="tag">default</span> value might be handy. Additionally, decide if the attribute should be a primitive or array of values.
92
+
If an attribute must be populated in all documents, set it as <code>required</code>. If not, a default value might be handy, but is not required. Additionally, decide if the attribute should be a primitive or an array of values.
94
93
</p>
95
94
<p>
96
-
When adding or removing attributes, your requests are processed in the background, indicated by the attribute's <span class="tag">status</span>.
97
-
Depending on your collection's size and other factors, this could take anywhere from a few seconds to a few minutes to complete. You are able to create a document while your attributes are still being processed, however you are not able to use the attributes on the documents until they are <span class="tag">available</span>
95
+
When adding or removing attributes, your requests are processed in the background, indicated by the attribute's <code>status</code>.
96
+
Depending on your collection's size and other factors, this could take anywhere from a few seconds to a few minutes to complete. You are able to create a document while your attributes are still being processed, but you are not able to use the attributes on the documents until their <code>status</code> becomes <code>available</code>.
<p>You can only query indexed attributes. You can easily add new indexes from both the Appwrite console or any of the <a href="/docs/sdks#server">server SDKs</a>. Appwrite uses this limitation to enforce optimized queries for maximum performance and scalability of your collection. You can learn more about it in the <a href="/docs/databases#indexes">Appwrite Indexes</a> section.</p>
213
+
<p>You can only query indexed attributes. You can easily add new indexes from both your project's dashboard or any of the <a href="/docs/sdks#server">server SDKs</a>. Appwrite uses this limitation to enforce optimized queries for maximum performance and scalability of your collection. You can learn more about it in the <a href="/docs/databases#indexes">Appwrite Indexes</a> section.</p>
215
214
</div>
216
215
<p>
217
-
To find specific documents in a collection, pass an array of query strings as a parameter to the <a href="/docs/server/databases#databasesListDocuments">listDocuments</a> endpoint. The SDKs provide a <b>Query</b> class to make query building simpler:
216
+
To find specific documents in a collection, pass an array of query strings as a parameter to the <a href="/docs/server/databases#databasesListDocuments">List Documents</a> endpoint. The SDKs provide a <code>Query</code> class to make query building simpler:
<td>Orders results in descending order by attribute. Attribute must be indexed. Pass in an empty string to return in natural order.</td>
380
379
</tr>
381
380
<tr>
382
-
<td>orderAsc</td>
383
-
<td>Query.orderAsc("attribute")</td>
381
+
<td>Order Ascending</td>
382
+
<td><code>Query.orderAsc("attribute")</code></td>
384
383
<td>Orders results in ascending order by attribute. Attribute must be indexed. Pass in an empty string to return in natural order.</td>
385
384
</tr>
386
385
<tr>
387
-
<td>limit</td>
388
-
<td>Query.limit(25)</td>
386
+
<td>Limit</td>
387
+
<td><code>Query.limit(25)</code></td>
389
388
<td>Limits the number of results returned by the query. Used for <a href="/docs/pagination#offset-pagination" id="offset-pagination">pagination</a>.</td>
390
389
</tr>
391
390
<tr>
392
-
<td>offset</td>
393
-
<td>Query.offset(0)</td>
391
+
<td>Offset</td>
392
+
<td><code>Query.offset(0)</code></td>
394
393
<td>Offset the results returned by skipping some of the results. Used for <a href="/docs/pagination#offset-pagination" id="offset-pagination">pagination</a>.</td>
<td>Places the cursor after the specified resource ID. Used for <a href="/docs/pagination#cursor-pagination" id="cursor-pagination">pagination</a>.</td>
<td>Places the cursor before the specified resource ID. Used for <a href="/docs/pagination#cursor-pagination" id="cursor-pagination">pagination</a>.</td>
405
404
</tr>
406
405
</tbody>
407
406
</table>
408
407
409
-
<p>Each query string is logically separated via AND. For OR logic, pass multiple values, separated by commas:</p>
408
+
<p>Each query string is logically separated via <code>AND</code> operation. For <code>OR</code> operation, pass multiple values separated by commas:</p>
410
409
<ul class="phases clear" data-ui-phases>
411
410
<li>
412
411
<h3>Web</h3>
@@ -515,15 +514,15 @@ func main() async throws {
515
514
</li>
516
515
</ul>
517
516
518
-
<p>When performing a query against multiple attributes, a single index with all query attributes is required. In the example above, a single index with <b>both</b> <span class="tag">title</span> and <span class="tag">year</span> is required.</p>
517
+
<p>When performing a query against multiple attributes, a single index with all query attributes is required. In the example above, a single index with <b>both</b> <code>title</code> and <code>year</code> is required.</p>
Indexes are used by Databases to quickly locate data without having to search through every document for results.
521
+
Databases use indexes to quickly locate data without having to search through every document for matches.
523
522
To ensure the best performance, Appwrite requires an index for every query.
524
-
You can create an index by navigating to the <b>Indexes</b> tab of your collection or by using your favorite Server SDK. If you plan to query multiple attributes in a single query, you will need an index with <b>all</b> queried attributes.
523
+
You can create an index by navigating to your collection's <b>Indexes</b> tab or by using your favorite Server SDK. If you plan to query multiple attributes in a single query, you will need an index with <b>all</b> queried attributes.
525
524
</p>
526
-
<p>It should be noted that Appwrite's database was designed to protect your queries from performing a full-table scan as this is a footgun and could cause catastrophic performance degradation as you scale up your Appwrite project.</p>
525
+
<p>It should be noted that Appwrite's Databases Service is designed to protect your queries from performing a full-table scan, as this could cause catastrophic performance degradation as you scale up your Appwrite project.</p>
527
526
<p>
528
527
The following indexes are currently supported:
529
528
</p>
@@ -536,15 +535,15 @@ func main() async throws {
536
535
</thead>
537
536
<tbody>
538
537
<tr>
539
-
<td>key</td>
538
+
<td><code>key</code></td>
540
539
<td>Plain Index to allow queries.</td>
541
540
</tr>
542
541
<tr>
543
-
<td>unique</td>
542
+
<td><code>unique</code></td>
544
543
<td>Unique Index which not allows duplicates.</td>
545
544
</tr>
546
545
<tr>
547
-
<td>fulltext</td>
546
+
<td><code>fulltext</code></td>
548
547
<td>For searching within string attributes</td>
549
548
</tr>
550
549
</tbody>
@@ -766,7 +765,7 @@ func main() async throws {
766
765
</li>
767
766
</ul>
768
767
769
-
<p>In the example above, the movies returned will be first sorted by title in ascending order, then sorted by year in descending order.</p>
768
+
<p>In the example above, the movies returned will be first sorted by <code>title</code> in ascending order, then sorted by <code>year</code> in descending order.</p>
<p>Appwrite has full support for pagination to better optimize and scale up your applications built on Appwrite. Detailed documentation on pagination and how to implement it can be found on the <a href="/docs/pagination">pagination guide.</a></p>
0 commit comments