Skip to content

Conversation

@adityaoberai
Copy link
Member

@adityaoberai adityaoberai commented Oct 27, 2025

What does this PR do?

Adds DB operators docs

Test Plan

  • Visit /docs/products/databases/db-operators

Related PRs and Issues

No

Have you read the Contributing Guidelines on issues?

Yes

Summary by CodeRabbit

  • Documentation
    • Added comprehensive "Database Operators" docs covering atomic and multi-field updates, transaction guidance, operator categories (Numeric, Array, String, Date, Boolean), usage patterns, a detailed how-it-works section, multi-language examples, and an operator reference.
    • Added a Journeys navigation entry "Database operators" with a temporary badge for discoverability, visible through Dec 31, 2025.

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Oct 27, 2025

Walkthrough

Adds a new documentation page at src/routes/docs/products/databases/db-operators/+page.markdoc documenting database operators (atomic per-field updates, multi-field transactional updates, operator categories, and JavaScript/Dart examples). Updates src/routes/docs/products/databases/+layout.svelte to insert a "Database operators" navigation item with href /docs/products/databases/db-operators and a badge valid until 31 Dec 2025, placed after the "CSV imports" entry. No runtime logic or exported API changes.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

  • Inspect the new markdoc frontmatter (layout, title, description) and overall structure.
  • Quick pass on code examples (JS/Dart) for obvious syntax or language inconsistencies and that operator names match the prose.
  • Verify the nav item placement, href, and badge metadata in src/routes/docs/products/databases/+layout.svelte.

Pre-merge checks and finishing touches

✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title 'Add DB operators docs' clearly and accurately summarizes the main change: adding documentation for database operators.
✨ Finishing touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch add-db-operators-docs

📜 Recent review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 4d6050b and 5e242d5.

📒 Files selected for processing (1)
  • src/routes/docs/products/databases/db-operators/+page.markdoc (1 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
  • src/routes/docs/products/databases/db-operators/+page.markdoc
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (2)
  • GitHub Check: tests
  • GitHub Check: build

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 2

♻️ Duplicate comments (1)
src/routes/docs/products/databases/db-operators/+page.markdoc (1)

57-80: Same issue as JavaScript example.

The Dart example has the same problems:

  1. Line 75 shows the full array ['a', 'b', 'c'] instead of just the value(s) to append
  2. Line 76's comment about the field being optional is misleading for arrayAppend
📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 5f9f671 and 9ae0959.

📒 Files selected for processing (2)
  • src/routes/docs/products/databases/+layout.svelte (1 hunks)
  • src/routes/docs/products/databases/db-operators/+page.markdoc (1 hunks)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (3)
  • GitHub Check: build
  • GitHub Check: format
  • GitHub Check: tests
🔇 Additional comments (2)
src/routes/docs/products/databases/+layout.svelte (1)

108-113: LGTM! Navigation item properly structured.

The new "Database operators" navigation item is correctly placed in the Journeys section with appropriate formatting and badge expiration date.

src/routes/docs/products/databases/db-operators/+page.markdoc (1)

1-13: LGTM! Well-structured introduction.

The frontmatter and introduction clearly communicate the purpose and benefits of database operators.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

♻️ Duplicate comments (1)
src/routes/docs/products/databases/db-operators/+page.markdoc (1)

52-74: Fix the Dart example to reflect TablesDB operators.

This block still wires up Databases.createOperations, feeds the full post-append array, and labels the data payload as optional. That contradicts the text above and Appwrite’s TablesDB samples, where rows are updated via TablesDB with operator helpers that carry only the value to append (and the payload is required). Please switch the example to TablesDB, show the operator call in data, and drop the “optional” wording so the Dart snippet mirrors the JS version and the actual SDK shapes. (appwrite.io) Based on learnings

📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between a1151cd and afacdd3.

📒 Files selected for processing (1)
  • src/routes/docs/products/databases/db-operators/+page.markdoc (1 hunks)
🧰 Additional context used
🧠 Learnings (3)
📚 Learning: 2025-09-05T19:35:04.162Z
Learnt from: ebenezerdon
Repo: appwrite/website PR: 2372
File: src/routes/docs/tutorials/nuxt/step-6/+page.markdoc:79-83
Timestamp: 2025-09-05T19:35:04.162Z
Learning: In Nuxt tutorial files, the correct Appwrite database instance to use is `tablesDB` (imported from "~/appwrite"), not `database`. All tablesDB method calls should use the object parameter format: listRows({ databaseId, tableId, queries }), createRow({ databaseId, tableId, rowId, data }), and deleteRow({ databaseId, tableId, rowId }).

Applied to files:

  • src/routes/docs/products/databases/db-operators/+page.markdoc
📚 Learning: 2025-09-05T19:35:59.449Z
Learnt from: ebenezerdon
Repo: appwrite/website PR: 2372
File: src/routes/docs/tutorials/react-native/step-6/+page.markdoc:67-73
Timestamp: 2025-09-05T19:35:59.449Z
Learning: In React Native tutorials, the lib/appwrite.js file exports `tablesDB` (not `databases`), so imports should use `import { tablesDB } from "../lib/appwrite"` to match the export pattern established in step-3.

Applied to files:

  • src/routes/docs/products/databases/db-operators/+page.markdoc
📚 Learning: 2025-09-05T19:35:53.943Z
Learnt from: ebenezerdon
Repo: appwrite/website PR: 2372
File: src/routes/docs/tutorials/react/step-6/+page.markdoc:70-75
Timestamp: 2025-09-05T19:35:53.943Z
Learning: In React tutorial files, the correct Appwrite database instance to import is `tablesDB` from "../appwrite", not `databases`. The import statement should be `import { tablesDB } from "../appwrite"` to match the usage throughout the React tutorial code.

Applied to files:

  • src/routes/docs/products/databases/db-operators/+page.markdoc
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (2)
  • GitHub Check: build
  • GitHub Check: tests

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🧹 Nitpick comments (1)
src/routes/docs/products/databases/db-operators/+page.markdoc (1)

93-93: Consider clarifying or demonstrating optional parameters.

Several numeric operator descriptions mention optional behavior (e.g., "Optionally cap the result at a maximum value"), but the examples show only single-parameter calls. If these operators accept additional parameters for capping/limiting, consider either:

  • Showing an example: Operator.increment(1, { max: 100 })
  • Or removing "Optionally" to avoid implying unavailable functionality

Also applies to: 106-106, 119-119, 132-132, 158-158

📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between afacdd3 and afe977d.

📒 Files selected for processing (1)
  • src/routes/docs/products/databases/db-operators/+page.markdoc (1 hunks)
🧰 Additional context used
🧠 Learnings (3)
📚 Learning: 2025-09-05T19:35:04.162Z
Learnt from: ebenezerdon
Repo: appwrite/website PR: 2372
File: src/routes/docs/tutorials/nuxt/step-6/+page.markdoc:79-83
Timestamp: 2025-09-05T19:35:04.162Z
Learning: In Nuxt tutorial files, the correct Appwrite database instance to use is `tablesDB` (imported from "~/appwrite"), not `database`. All tablesDB method calls should use the object parameter format: listRows({ databaseId, tableId, queries }), createRow({ databaseId, tableId, rowId, data }), and deleteRow({ databaseId, tableId, rowId }).

Applied to files:

  • src/routes/docs/products/databases/db-operators/+page.markdoc
📚 Learning: 2025-09-05T19:35:59.449Z
Learnt from: ebenezerdon
Repo: appwrite/website PR: 2372
File: src/routes/docs/tutorials/react-native/step-6/+page.markdoc:67-73
Timestamp: 2025-09-05T19:35:59.449Z
Learning: In React Native tutorials, the lib/appwrite.js file exports `tablesDB` (not `databases`), so imports should use `import { tablesDB } from "../lib/appwrite"` to match the export pattern established in step-3.

Applied to files:

  • src/routes/docs/products/databases/db-operators/+page.markdoc
📚 Learning: 2025-09-05T19:35:53.943Z
Learnt from: ebenezerdon
Repo: appwrite/website PR: 2372
File: src/routes/docs/tutorials/react/step-6/+page.markdoc:70-75
Timestamp: 2025-09-05T19:35:53.943Z
Learning: In React tutorial files, the correct Appwrite database instance to import is `tablesDB` from "../appwrite", not `databases`. The import statement should be `import { tablesDB } from "../appwrite"` to match the usage throughout the React tutorial code.

Applied to files:

  • src/routes/docs/products/databases/db-operators/+page.markdoc
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (2)
  • GitHub Check: build
  • GitHub Check: tests
🔇 Additional comments (3)
src/routes/docs/products/databases/db-operators/+page.markdoc (3)

32-49: LGTM! Example addresses previous feedback correctly.

The JavaScript example now:

  • Imports Operator from "appwrite" (addressing previous missing import concern)
  • Uses tablesDB consistently with the codebase pattern
  • Shows Operator.arrayAppend(['c']) correctly passing only the value to append, not the full resulting array

51-68: LGTM! Dart example is correct and consistent.

The Dart example properly demonstrates the operator pattern with:

  • Correct import statement
  • TablesDB instance usage
  • Proper Operator.arrayAppend(['c']) syntax matching the JavaScript example

337-348: LGTM! Date operator naming is correct.

The dateSetNow operator is correctly named (addressing the previous typo concern about "dateSetNo"). The implementation and examples look good.

Comment on lines 270 to 274
Operator.arrayFilter(Condition.GreaterThan, 10)
```
```dart
Operator.arrayFilter(Condition.GreaterThan, 10)
```
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟠 Major

Add import and explanation for Condition enum.

The arrayFilter example references Condition.GreaterThan, but Condition is never imported or explained. Users copying this code will encounter a ReferenceError.

Update the documentation to either:

  1. Add Condition to the import example at the top (lines 33, 52)
  2. Or include a standalone import example in this section showing: import { Condition } from "appwrite"
  3. And briefly explain what Condition values are available (e.g., GreaterThan, LessThan, Equals, etc.)
🤖 Prompt for AI Agents
In src/routes/docs/products/databases/db-operators/+page.markdoc around lines
270 to 274, the example uses Condition.GreaterThan but Condition is never
imported or explained; update the docs to either add Condition to the existing
import examples at the top of the file (lines ~33 and ~52) or add a standalone
import near this example (e.g., import { Condition } from "appwrite"), and add
one short sentence listing the common Condition enum values (GreaterThan,
LessThan, Equals, etc.) so readers know what constants are available.

abnegate and others added 3 commits November 4, 2025 20:16
Co-authored-by: Aditya Oberai <adityaoberai1@gmail.com>
Co-authored-by: Aditya Oberai <adityaoberai1@gmail.com>
Co-authored-by: Aditya Oberai <adityaoberai1@gmail.com>
Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

♻️ Duplicate comments (1)
src/routes/docs/products/databases/db-operators/+page.markdoc (1)

794-824: Import and document the Condition enum for arrayFilter examples.

All arrayFilter examples reference Condition.GreaterThan, but Condition is never imported in any of the code examples throughout the page. Users copying these snippets will encounter a ReferenceError.

To fix this issue:

  1. Add Condition to the imports at the top of the page (lines 33, 52, etc.):

    -import { Client, TablesDB, Operator } from "appwrite";
    +import { Client, TablesDB, Operator, Condition } from "appwrite";
  2. Add a brief explanation near the arrayFilter section describing available Condition values (e.g., GreaterThan, LessThan, Equals, NotEquals, etc.) so developers know what constants are available.

Alternatively, add a standalone import example in the arrayFilter section (lines 790-793) before the multicode block.

📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between acf0d91 and 4d6050b.

📒 Files selected for processing (1)
  • src/routes/docs/products/databases/db-operators/+page.markdoc (1 hunks)
🧰 Additional context used
🧠 Learnings (3)
📚 Learning: 2025-09-05T19:35:04.162Z
Learnt from: ebenezerdon
Repo: appwrite/website PR: 2372
File: src/routes/docs/tutorials/nuxt/step-6/+page.markdoc:79-83
Timestamp: 2025-09-05T19:35:04.162Z
Learning: In Nuxt tutorial files, the correct Appwrite database instance to use is `tablesDB` (imported from "~/appwrite"), not `database`. All tablesDB method calls should use the object parameter format: listRows({ databaseId, tableId, queries }), createRow({ databaseId, tableId, rowId, data }), and deleteRow({ databaseId, tableId, rowId }).

Applied to files:

  • src/routes/docs/products/databases/db-operators/+page.markdoc
📚 Learning: 2025-09-05T19:35:59.449Z
Learnt from: ebenezerdon
Repo: appwrite/website PR: 2372
File: src/routes/docs/tutorials/react-native/step-6/+page.markdoc:67-73
Timestamp: 2025-09-05T19:35:59.449Z
Learning: In React Native tutorials, the lib/appwrite.js file exports `tablesDB` (not `databases`), so imports should use `import { tablesDB } from "../lib/appwrite"` to match the export pattern established in step-3.

Applied to files:

  • src/routes/docs/products/databases/db-operators/+page.markdoc
📚 Learning: 2025-09-05T19:35:53.943Z
Learnt from: ebenezerdon
Repo: appwrite/website PR: 2372
File: src/routes/docs/tutorials/react/step-6/+page.markdoc:70-75
Timestamp: 2025-09-05T19:35:53.943Z
Learning: In React tutorial files, the correct Appwrite database instance to import is `tablesDB` from "../appwrite", not `databases`. The import statement should be `import { tablesDB } from "../appwrite"` to match the usage throughout the React tutorial code.

Applied to files:

  • src/routes/docs/products/databases/db-operators/+page.markdoc

Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
@adityaoberai adityaoberai merged commit 606c87f into main Nov 4, 2025
4 checks passed
@adityaoberai adityaoberai deleted the add-db-operators-docs branch November 4, 2025 08:36
@stnguyen90 stnguyen90 mentioned this pull request Nov 7, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants