diff --git a/package.json b/package.json index b4539037c..37c0fc913 100644 --- a/package.json +++ b/package.json @@ -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", diff --git a/src/routes/docs/products/databases/queries/+page.markdoc b/src/routes/docs/products/databases/queries/+page.markdoc index dc55fa3b1..51714065f 100644 --- a/src/routes/docs/products/databases/queries/+page.markdoc +++ b/src/routes/docs/products/databases/queries/+page.markdoc @@ -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 %} @@ -337,7 +337,7 @@ void main() async { try { final documents = await databases.listDocuments( '', - '[COLLECTION_ID]', + '', [ Query.equal('title', ['Avatar', 'Lord of the Rings']), Query.greaterThan('year', 1999) @@ -404,7 +404,7 @@ query { databasesListDocuments( databaseId: "", collectionId: "" - queries: [ + queries: [ "{\"method\":\"equal\",\"attribute\":\"title\",\"values\":[\"Avatar\",\"Lord of the Rings\"]}", "{\"method\":\"greaterThan\",\"attribute\":\"year\",\"values\":[1999]}" ] @@ -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( + '', + '', + [ + 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( + '', + '', + [ + 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='', + 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: '', + collectionId: '', + 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 = '', + collectionId = '', + 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. + diff --git a/src/routes/docs/quick-starts/+page.svelte b/src/routes/docs/quick-starts/+page.svelte index 890831f61..55f7a578d 100644 --- a/src/routes/docs/quick-starts/+page.svelte +++ b/src/routes/docs/quick-starts/+page.svelte @@ -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', @@ -43,47 +37,47 @@ 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', @@ -91,16 +85,22 @@ 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' } ] }, @@ -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', @@ -131,18 +131,18 @@ image: '/images/blog/placeholder.png', href: 'php' }, + { + title: 'Dart', + icon: 'icon-dart', + image: '/images/blog/placeholder.png', + href: 'dart' + }, { title: 'Ruby', icon: 'icon-ruby', image: '/images/blog/placeholder.png', href: 'ruby' }, - { - title: '.NET', - icon: 'icon-dotnet', - image: '/images/blog/placeholder.png', - href: 'dotnet' - }, { title: 'Deno', icon: 'icon-deno', diff --git a/src/routes/integrations/+page.svelte b/src/routes/integrations/+page.svelte index 6c48160ff..f1e054890 100644 --- a/src/routes/integrations/+page.svelte +++ b/src/routes/integrations/+page.svelte @@ -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;