Skip to content

Commit

Permalink
Merge branch 'main' into mobile-select-bug
Browse files Browse the repository at this point in the history
  • Loading branch information
ItzNotABug authored Feb 21, 2025
2 parents bbf0f85 + e010ed0 commit 2cba298
Show file tree
Hide file tree
Showing 4 changed files with 142 additions and 42 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
"optimize": "node ./scripts/optimize-assets.js",
"optimize:all": "node ./scripts/optimize-all.js"
},
"packageManager": "pnpm@10.2.0+sha512.0d27364e0139c6aadeed65ada153135e0ca96c8da42123bd50047f961339dc7a758fc2e944b428f52be570d1bd3372455c1c65fa2e7aa0bfbf931190f9552001",
"packageManager": "pnpm@10.4.1",
"dependencies": {
"@number-flow/svelte": "^0.3.3",
"@sentry/sveltekit": "^8.51.0",
Expand Down
108 changes: 104 additions & 4 deletions src/routes/docs/products/databases/queries/+page.markdoc
Original file line number Diff line number Diff line change
Expand Up @@ -296,11 +296,11 @@ Appwrite SDKs provide a `Query` class to help you build queries. The `Query` cla

Queries are passed to an endpoint through the `queries` parameter as an array of query strings, which can be generated using the `Query` class.

Each query method is logically separated via `AND` operations. For `OR` operation, pass multiple values into the query method separated by commas.
Each query method is logically separated via `AND` operations. For `OR` operation, pass multiple values into the query method separated by commas.
For example `Query.equal('title', ['Avatar', 'Lord of the Rings'])` will fetch the movies `Avatar` or `Lord of the Rings`.

{% info title="Default pagination behavior" %}
By default, results are limited to the **first 25 items**.
By default, results are limited to the **first 25 items**.
You can change this through [pagination](/docs/products/databases/pagination).
{% /info %}

Expand Down Expand Up @@ -337,7 +337,7 @@ void main() async {
try {
final documents = await databases.listDocuments(
'<DATABASE_ID>',
'[COLLECTION_ID]',
'<COLLECTION_ID>',
[
Query.equal('title', ['Avatar', 'Lord of the Rings']),
Query.greaterThan('year', 1999)
Expand Down Expand Up @@ -404,7 +404,7 @@ query {
databasesListDocuments(
databaseId: "<DATABASE_ID>",
collectionId: "<COLLECTION_ID>"
queries: [
queries: [
"{\"method\":\"equal\",\"attribute\":\"title\",\"values\":[\"Avatar\",\"Lord of the Rings\"]}",
"{\"method\":\"greaterThan\",\"attribute\":\"year\",\"values\":[1999]}"
]
Expand All @@ -418,3 +418,103 @@ query {
}
```
{% /multicode %}

## Complex Queries
You can create complex queries by combining AND and OR operations. For example, to find items that are either books under $20 or magazines under $10.

{% multicode %}
```client-web
const results = await databases.listDocuments(
'<DATABASE_ID>',
'<COLLECTION_ID>',
[
Query.or([
Query.and([
Query.equal('category', ['books']),
Query.lessThan('price', 20)
]),
Query.and([
Query.equal('category', ['magazines']),
Query.lessThan('price', 10)
])
])
]
);
```
```client-flutter
final results = await databases.listDocuments(
'<DATABASE_ID>',
'<COLLECTION_ID>',
[
Query.or([
Query.and([
Query.equal('category', ['books']),
Query.lessThan('price', 20)
]),
Query.and([
Query.equal('category', ['magazines']),
Query.lessThan('price', 10)
])
])
]
);
```
```python
results = databases.list_documents(
database_id='<DATABASE_ID>',
collection_id='<COLLECTION_ID>',
queries=[
Query.or_queries([
Query.and_queries([
Query.equal('category', ['books']),
Query.less_than('price', 20)
]),
Query.and_queries([
Query.equal('category', ['magazines']),
Query.less_than('price', 10)
])
])
]
)
```
```client-apple
let results = try await databases.listDocuments(
databaseId: '<DATABASE_ID>',
collectionId: '<COLLECTION_ID>',
queries: [
Query.or([
Query.and([
Query.equal("category", value: ["books"]),
Query.lessThan("price", value: 20)
]),
Query.and([
Query.equal("category", value: ["magazines"]),
Query.lessThan("price", value: 10)
])
])
]
)
```
```kotlin
val results = databases.listDocuments(
databaseId = '<DATABASE_ID>',
collectionId = '<COLLECTION_ID>',
queries = listOf(
Query.or(listOf(
Query.and(listOf(
Query.equal("category", ["books"]),
Query.lessThan("price", 20)
)),
Query.and(listOf(
Query.equal("category", ["magazines"]),
Query.lessThan("price", 10)
))
))
)
)
```
{% /multicode %}

This example demonstrates how to combine `OR` and `AND` operations. The query uses `Query.or()` to match either condition: books under $20 OR magazines under $10.
Each condition within the OR is composed of two AND conditions - one for the category and one for the price threshold. The database will return documents that match either of these combined conditions.

72 changes: 36 additions & 36 deletions src/routes/docs/quick-starts/+page.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,6 @@
{
title: 'Web app',
quickStarts: [
{
title: 'Web',
icon: 'icon-js',
image: '/images/blog/placeholder.png',
href: 'web'
},
{
title: 'Next.js',
icon: 'icon-nextjs',
Expand All @@ -43,64 +37,70 @@
image: '/images/blog/placeholder.png',
href: 'vue'
},
{
title: 'Nuxt',
icon: 'web-icon-nuxt',
image: '/images/blog/placeholder.png',
href: 'nuxt'
},
{
title: 'SvelteKit',
icon: 'icon-svelte',
image: '/images/blog/placeholder.png',
href: 'sveltekit'
},
{
title: 'Refine',
icon: 'web-icon-refine',
image: '/images/blog/placeholder.png',
href: 'refine'
},
{
title: 'Angular',
icon: 'icon-angular',
image: '/images/blog/placeholder.png',
href: 'angular'
},
{
title: 'Nuxt',
icon: 'web-icon-nuxt',
image: '/images/blog/placeholder.png',
href: 'nuxt'
},
{
title: 'Refine',
icon: 'web-icon-refine',
image: '/images/blog/placeholder.png',
href: 'refine'
},
{
title: 'Solid',
icon: 'icon-solidjs',
image: '/images/blog/placeholder.png',
href: 'solid'
},
{
title: 'Web',
icon: 'icon-js',
image: '/images/blog/placeholder.png',
href: 'web'
}
]
},
{
title: 'Mobile and native',
quickStarts: [
{
title: 'React Native',
icon: 'icon-react-native',
image: '/images/blog/placeholder.png',
href: 'react-native'
},
{
title: 'Flutter',
icon: 'icon-flutter',
image: '/images/blog/placeholder.png',
href: 'flutter'
},
{
title: 'Apple',
icon: 'icon-apple',
title: 'React Native',
icon: 'icon-react-native',
image: '/images/blog/placeholder.png',
href: 'apple'
href: 'react-native'
},
{
title: 'Android',
icon: 'icon-android',
image: '/images/blog/placeholder.png',
href: 'android'
},
{
title: 'Apple',
icon: 'icon-apple',
image: '/images/blog/placeholder.png',
href: 'apple'
}
]
},
Expand All @@ -120,10 +120,10 @@
href: 'python'
},
{
title: 'Dart',
icon: 'icon-dart',
title: '.NET',
icon: 'icon-dotnet',
image: '/images/blog/placeholder.png',
href: 'dart'
href: 'dotnet'
},
{
title: 'PHP',
Expand All @@ -132,16 +132,16 @@
href: 'php'
},
{
title: 'Ruby',
icon: 'icon-ruby',
title: 'Dart',
icon: 'icon-dart',
image: '/images/blog/placeholder.png',
href: 'ruby'
href: 'dart'
},
{
title: '.NET',
icon: 'icon-dotnet',
title: 'Ruby',
icon: 'icon-ruby',
image: '/images/blog/placeholder.png',
href: 'dotnet'
href: 'ruby'
},
{
title: 'Deno',
Expand Down
2 changes: 1 addition & 1 deletion src/routes/integrations/+page.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -602,7 +602,7 @@
margin-bottom: f.pxToRem(60);
@media #{devices.$break2open} {
position: sticky;
top: 50px;
top: 90px;
height: 500px;
transition: top 0.3s ease;
Expand Down

0 comments on commit 2cba298

Please sign in to comment.