diff --git a/app/docs/page.tsx b/app/docs/page.tsx index ca0e3b0..41d2782 100644 --- a/app/docs/page.tsx +++ b/app/docs/page.tsx @@ -1,8 +1,2407 @@ -import Link from "next/link"; -import { getArticleContent } from "../services/articleService"; + +"use client"; +import { useState } from "react"; export default function Docs() { - const articleContent = getArticleContent(); + const [currentPage, setCurrentPage] = useState("main"); + const [selectedOperator, setSelectedOperator] = useState("Accumulator"); + const [selectedPostgresItem, setSelectedPostgresItem] = + useState("Components"); + const [selectedGettingStartedItem, setSelectedGettingStartedItem] = useState( + "Python Setup Guide", + ); + + const operatorCategories = [ + "Accumulator", + "Aggregation", + "Arithmetic Expression", + "Array Expression", + "Array Query", + "Array Update", + "Bitwise", + "Bitwise Query", + "Bitwise Update", + "Boolean Expression", + "Comparison Query", + "Conditional Expression", + "Date Expression", + "Data Size", + "Element Query", + "Evaluation Query", + "Field Update", + "Geospatial", + "Logical Query", + "Miscellaneous", + "Object Expression", + "Projection", + "Timestamp Expression", + "Set Expression", + "Variable Expression", + "Window" + ]; + + const postgresMenuItems = ["Components", "Functions"]; + + const gettingStartedMenuItems = [ + "Python Setup Guide", + "VS Code Extension Quick Start", + "MongoDB Shell Quick Start" + ]; + + if (currentPage === "postgres-api") { + return ( +
+ {/* Background elements */} +
+
+
+
+
+ +
+ {/* Left Sidebar */} +
+ {/* Header */} +
+ +

+ Postgres Extension API +

+
+ + {/* Menu Items */} +
+ +
+
+ + {/* Main Content */} +
+
+
+

+ {selectedPostgresItem} +

+
+ {selectedPostgresItem !== "Components" && ( +

+ Comprehensive documentation for PostgreSQL extension{" "} + {selectedPostgresItem.toLowerCase()} and their usage + patterns. +

+ )} +
+ + {/* Content based on selected postgres item */} + {selectedPostgresItem === "Components" ? ( +
+ {/* pg_documentdb_core Section */} +
+

+ pg_documentdb_core +

+

+ pg_documentdb_core is a PostgreSQL extension that + introduces BSON datatype support and operations for native + Postgres. This core component is essential for enabling + document-oriented NoSQL capabilities within a PostgreSQL + environment. It provides the foundational data structures + and functions required to handle BSON data types, which + are crucial for performing CRUD operations on documents. +

+ +

+ Key Features +

+
    +
  • + +
    + + BSON Datatype Support: + {" "} + Adds BSON (Binary JSON) datatype to PostgreSQL, + allowing for efficient storage and manipulation of + JSON-like documents. +
    +
  • +
  • + +
    + + Native Operations: + {" "} + Implements native PostgreSQL operations for BSON data, + ensuring seamless integration and performance. +
    +
  • +
  • + +
    + + Extensibility: + {" "} + Serves as the core building block for additional + functionalities and extensions within the DocumentDB + ecosystem. +
    +
  • +
+
+ + {/* pg_documentdb_api Section */} +
+

+ pg_documentdb_api +

+

+ pg_documentdb_api is the public API surface for + DocumentDB, providing CRUD functionality on documents + stored in the database. This component leverages the + capabilities of pg_documentdb_core to offer a + comprehensive set of APIs for managing document data + within PostgreSQL. +

+ +

+ Key Features +

+
    +
  • + +
    + + CRUD Operations: + {" "} + Provides a rich set of APIs for creating, reading, + updating, and deleting documents. +
    +
  • +
  • + +
    + + Advanced Queries: + {" "} + Supports complex queries, including full-text + searches, geospatial queries, and vector embeddings. +
    +
  • +
  • + +
    + + Integration: + {" "} + Works seamlessly with pg_documentdb_core to deliver + robust document management capabilities. +
    +
  • +
+ +

+ Usage +

+

+ To use pg_documentdb_api, you need to have + pg_documentdb_core installed and configured in your + PostgreSQL environment. Once set up, you can leverage the + APIs provided by pg_documentdb_api to perform various + document operations. +

+
+
+ ) : selectedPostgresItem === "Functions" ? ( +
+ {/* Table of Contents */} +
+

+ Table of Contents +

+ + {/* CRUD Operations */} +
+

+ CRUD Operations +

+
+ {[ + "aggregate_cursor_first_page()", + "count_query()", + "cursor_get_more()", + "delete()", + "distinct_query()", + "find_and_modify()", + "find_cursor_first_page()", + "insert()", + "insert_one()", + "list_collections_cursor_first_page()", + "list_indexes_cursor_first_page()", + "update()", + ].map((func) => ( + + {func} + + ))} +
+
+ + {/* Collection Management */} +
+

+ Collection Management +

+
+ {[ + "coll_mod()", + "create_collection()", + "create_collection_view()", + "drop_collection()", + "drop_database()", + "rename_collection()", + "shard_collection()", + ].map((func) => ( + + {func} + + ))} +
+
+ + {/* User Management */} +
+

+ User Management +

+
+ {[ + "create_user()", + "drop_user()", + "update_user()", + "users_info()", + ].map((func) => ( + + {func} + + ))} +
+
+ + {/* Utility Functions */} +
+

+ Utility Functions +

+
+ {["binary_extended_version()", "binary_version()"].map( + (func) => ( + + {func} + + ), + )} +
+
+
+
+ ) : ( + /* Sample content for other items */ +
+
+

+ Overview +

+

+ The {selectedPostgresItem} section provides comprehensive + information about PostgreSQL extension capabilities. These + components are essential for building robust database + applications with document storage features. +

+
+

+ Example usage: +

+ + SELECT * FROM pg_extension WHERE extname = 'documentdb'; + +
+
+
+ )} +
+
+
+
+ ); + } + + if (currentPage === "getting-started") { + return ( +
+ {/* Background elements */} +
+
+
+
+
+ +
+ {/* Left Sidebar */} +
+ {/* Header */} +
+ +

Getting Started

+
+ + {/* Menu Items */} +
+ +
+
+ + {/* Main Content */} +
+
+
+

+ {selectedGettingStartedItem} +

+
+

+ Quick start guide for{" "} + {selectedGettingStartedItem.toLowerCase()}. +

+
+ + {/* Content based on selected getting started item */} + {selectedGettingStartedItem === + "VS Code Extension Quick Start" ? ( +
+ {/* Introduction */} +
+

+ Get started with DocumentDB using the Visual Studio Code + extension for a seamless development experience. +

+
+ + {/* Prerequisites */} +
+

+ Prerequisites +

+
    +
  • + + Visual Studio Code installed +
  • +
  • + + Docker Desktop installed and running +
  • +
  • + + Basic familiarity with document databases +
  • +
  • + + Git installed (for cloning the repository) +
  • +
+
+ + {/* Installing the Extension */} +
+

+ Installing the Extension +

+
    +
  1. + 1. + Open VS Code +
  2. +
  3. + 2. + + Navigate to the Extensions marketplace ( + + Ctrl+Shift+X + {" "} + or{" "} + + Cmd+Shift+X + + ) + +
  4. +
  5. + 3. + Search for "DocumentDB for VS Code" +
  6. +
  7. + 4. + Click Install +
  8. +
  9. + 5. + Reload VS Code if prompted +
  10. +
+
+ + {/* Setting Up Your First Database */} +
+

+ Setting Up Your First Database +

+ +
+
+

+ 1. Creating a new DocumentDB instance +

+
+
+                            {`docker pull ghcr.io/microsoft/documentdb/documentdb-local:latest
+docker tag ghcr.io/microsoft/documentdb/documentdb-local:latest documentdb
+docker run -dt -p 10260:10260 --name documentdb-container documentdb --username  --password 
+docker image rm -f ghcr.io/microsoft/documentdb/documentdb-local:latest || echo "No existing documentdb image to remove"`}
+                          
+
+
+

+ Note: Replace{" "} + + <YOUR_USERNAME> + {" "} + and{" "} + + <YOUR_PASSWORD> + {" "} + with your desired credentials. You must set these + when creating the container for authentication to + work. +

+
+
+

+ Port Note: Port{" "} + + 10260 + {" "} + is used by default in these instructions to avoid + conflicts with other local database services. You + can use port{" "} + + 27017 + {" "} + (the standard MongoDB port) or any other available + port if you prefer. If you do, be sure to update the + port number in both your{" "} + + docker run + {" "} + command and your connection string accordingly. +

+
+
+ +
+

+ 2. Connecting to your database +

+
    +
  • + + + Click the DocumentDB icon in the VS Code sidebar + +
  • +
  • + + Click "Add New Connection" +
  • +
  • + + + On the navigation bar, click on "Connection + String" + +
  • +
  • + + Paste your connection string: +
  • +
+
+ + mongodb://<YOUR_USERNAME>:<YOUR_PASSWORD>@localhost:10260/?tls=true&tlsAllowInvalidCertificates=true&authMechanism=SCRAM-SHA-256 + +
+
+ +
+

+ 3. Creating your first database and collection +

+
    +
  • + + + Click on the drop-down next to your local + connection and select "Create Database..." + +
  • +
  • + + Enter database name and confirm +
  • +
  • + + + Click on the drop-down next to your created + database and select "Create Collection..." + +
  • +
  • + + Enter collection name and confirm +
  • +
  • + + + Repeat for every database and collection you wish + to create under your connection + +
  • +
+
+
+
+ + {/* Working with Documents */} +
+

+ Working with Documents +

+ +
+
+

+ 1. Creating documents +

+
    +
  • + + Use the Table View for quick data entry +
  • +
  • + + + Use the Tree View for hierarchical data + exploration + +
  • +
  • + + + Use the JSON View for detailed document structure + +
  • +
+
+
+                            {`{
+  "name": "Test Document",
+  "type": "example",
+  "created_at": new Date()
+}`}
+                          
+
+
+ +
+

+ 2. Using the document explorer +

+
    +
  • + + Browse documents in multiple views: +
  • +
+
+
+ - + Table View for quick insights +
+
+ - + Tree View for hierarchical exploration +
+
+ - + JSON View for detailed structure +
+
+
    +
  • + + + Use smooth pagination for large datasets + +
  • +
+
+
+
+ + {/* Import and Export */} +
+

+ Import and Export +

+ +
+
+

+ 1. Importing data +

+
    +
  • + + + Click on the "Import" button on each collection + +
  • +
  • + + Choose your JSON file +
  • +
  • + + Confirm import +
  • +
+
+ +
+

+ 2. Exporting data +

+
    +
  • + + + Export entire collections or query results using + the "Export" button on each collection + +
  • +
+
+
+
+
+ ) : selectedGettingStartedItem === "MongoDB Shell Quick Start" ? ( +
+ {/* Introduction */} +
+

+ Get started with DocumentDB using the MongoDB shell for a + familiar MongoDB-compatible experience. +

+
+ + {/* Prerequisites */} +
+

+ Prerequisites +

+
    +
  • + + MongoDB Shell (mongosh) installed +
  • +
  • + + Docker Desktop installed and running +
  • +
  • + + Basic MongoDB knowledge +
  • +
  • + + Git installed (for cloning the repository) +
  • +
+
+ + {/* Installation */} +
+

+ Installation +

+ +
+
+

+ 1. Setting up DocumentDB locally +

+
+
+                            {`# Pull the latest DocumentDB Docker image
+docker pull ghcr.io/microsoft/documentdb/documentdb-local:latest
+
+# Tag the image for convenience
+docker tag ghcr.io/microsoft/documentdb/documentdb-local:latest documentdb
+
+# Run the container with your chosen username and password
+docker run -dt -p 10260:10260 --name documentdb-container documentdb --username  --password 
+docker image rm -f ghcr.io/microsoft/documentdb/documentdb-local:latest || echo "No existing documentdb image to remove"`}
+                          
+
+
+

+ Note: Replace{" "} + + <YOUR_USERNAME> + {" "} + and{" "} + + <YOUR_PASSWORD> + {" "} + with your desired credentials. You must set these + when creating the container for authentication to + work. +

+
+
+

+ Port Note: Port{" "} + + 10260 + {" "} + is used by default in these instructions to avoid + conflicts with other local database services. You + can use port{" "} + + 27017 + {" "} + (the standard MongoDB port) or any other available + port if you prefer. If you do, be sure to update the + port number in both your{" "} + + docker run + {" "} + command and your connection string accordingly. +

+
+
+ +
+

+ 2. Starting the server +

+
+
+                            {`# The server will be available at localhost:10260 (or your chosen port)
+# You can verify the server is running using:
+docker ps`}
+                          
+
+
+
+
+ + {/* Connecting to DocumentDB */} +
+

+ Connecting to DocumentDB +

+

+ Connection string format +

+
+
+                        {`mongosh "mongodb://:@localhost:10260/?tls=true&tlsAllowInvalidCertificates=true"`}
+                      
+
+
+ + {/* Basic Operations */} +
+

+ Basic Operations +

+ +
+
+

+ 1. Creating databases and collections +

+
+
+                            {`// Create/switch to a database
+use mydb
+
+// Create a collection
+db.createCollection("users")
+
+// Create another collection
+db.createCollection("logs")`}
+                          
+
+
+ +
+

+ 2. Inserting documents +

+
+
+                            {`// Insert a single document
+db.users.insertOne({ name: "John Doe", email: "john@example.com", created_at: new Date() })
+
+// Insert multiple documents
+db.users.insertMany([
+  { name: "Jane Smith", email: "jane@example.com" }, 
+  { name: "Bob Johnson", email: "bob@example.com" }
+])`}
+                          
+
+
+ +
+

+ 3. Querying documents +

+
+
+                            {`// Find all documents
+db.users.find()
+
+// Find with criteria
+db.users.find({ name: "John Doe" })
+
+// Find with projection
+db.users.find({}, { name: 1, email: 1, _id: 0 })
+
+// Complex queries
+db.users.find(
+{ $and: 
+  [{ 
+    created_at: { $gte: new Date("2025-01-01") } 
+   }, 
+   { 
+    email: { $regex: "@example.com$" } 
+   }
+  ] 
+})`}
+                          
+
+
+ +
+

+ 4. Updating documents +

+
+
+                            {`// Update a single document
+db.users.updateOne({ name: "John Doe" }, { $set: { status: "active" } })
+
+// Update multiple documents
+db.users.updateMany({ email: { $regex: "@example.com$" } }, { $set: { domain: "example.com" } })`}
+                          
+
+
+ +
+

+ 5. Deleting documents +

+
+
+                            {`// Delete a single document
+db.users.deleteOne({ name: "John Doe" })
+
+// Delete multiple documents
+db.users.deleteMany({ status: "inactive" })`}
+                          
+
+
+
+
+ + {/* Working with Indexes */} +
+

+ Working with Indexes +

+ +
+
+

+ 1. Understanding index types +

+
+
+                            {`// Available index types:
+// - Single field
+// - Compound
+// - Multi-key
+// - Text
+// - Geospatial
+// - Vector`}
+                          
+
+
+ +
+

+ 2. Creating indexes +

+
+
+                            {`// Single field index
+db.users.createIndex({ email: 1 })
+
+// Compound index
+db.users.createIndex({ name: 1, email: 1 })
+`}
+                          
+
+
+
+
+ + {/* Monitoring and Management */} +
+

+ Monitoring and Management +

+ +
+
+

+ 1. Database statistics +

+
+
+                            {`// Get database stats
+db.stats()
+
+// Get collection stats
+db.users.stats()`}
+                          
+
+
+ +
+

+ 2. Collection statistics +

+
+
+                            {`// Get collection size
+db.users.dataSize()
+
+// Get index sizes
+db.users.stats().indexSizes`}
+                          
+
+
+
+
+
+ ) : selectedGettingStartedItem === "Python Setup Guide" ? ( +
+ {/* Introduction */} +
+

+ Learn how to set up and use DocumentDB with Python using the MongoDB Python driver (PyMongo). +

+
+ + {/* Prerequisites */} +
+

+ Prerequisites +

+
    +
  • + + Python 3.7+ +
  • +
  • + + pip package manager +
  • +
  • + + Docker +
  • +
  • + + Git (for cloning the repository) +
  • +
+
+ + {/* Step 1: Install Python */} +
+

+ Step 1: Install Python +

+ +
+
+                {`pip install pymongo`}
+                      
+
+
+ + {/* Step 2: Install optional dependencies */} +
+

+ Step 2: Install optional dependencies +

+ +
+
+                {`pip install dnspython`}
+                      
+
+
+ + {/* Step 3: Setup DocumentDB using Docker */} +
+

+ Step 3: Setup DocumentDB using Docker +

+ +
+
+                {`# Pull the latest DocumentDB Docker image
+docker pull ghcr.io/microsoft/documentdb/documentdb-local:latest
+
+# Tag the image for convenience
+docker tag ghcr.io/microsoft/documentdb/documentdb-local:latest documentdb
+
+# Run the container with your chosen username and password
+docker run -dt -p 10260:10260 --name documentdb-container documentdb --username  --password 
+docker image rm -f ghcr.io/microsoft/documentdb/documentdb-local:latest || echo "No existing documentdb image to remove"`}
+                      
+
+ +
+

+ Note: During the transition to the Linux Foundation, Docker images may still be hosted on Microsoft's container registry. These will be migrated to the new DocumentDB organization as the transition completes. +

+
+ +
+

+ Note: Replace{" "} + + <YOUR_USERNAME> + {" "} + and{" "} + + <YOUR_PASSWORD> + {" "} + with your desired credentials. You must set these when creating the container for authentication to work. +

+
+ +
+

+ Port Note: Port{" "} + + 10260 + {" "} + is used by default in these instructions to avoid conflicts with other local database services. You can use port{" "} + + 27017 + {" "} + (the standard MongoDB port) or any other available port if you prefer. If you do, be sure to update the port number in both your{" "} + + docker run + {" "} + command and your connection string accordingly. +

+
+
+ + {/* Step 4: Initialize the pymongo client */} +
+

+ Step 4: Initialize the pymongo client with the credentials from the previous step +

+ +
+
+                {`import pymongo
+from pymongo import MongoClient
+
+# Create a MongoDB client and open a connection to DocumentDB
+client = pymongo.MongoClient(
+    'mongodb://:@localhost:10260/?tls=true&tlsAllowInvalidCertificates=true'
+                )`}
+                      
+
+
+ + {/* Step 5: Create a database and collection */} +
+

+ Step 5: Create a database and collection +

+ +
+
+                {`quickStartDatabase = client["quickStartDatabase"]
+quickStartCollection = quickStartDatabase.create_collection("quickStartCollection")`}
+                      
+
+
+ + {/* Step 6: Insert documents */} +
+

+ Step 6: Insert documents +

+ +
+
+                {`# Insert a single document
+quickStartCollection.insert_one({
+       'name': 'John Doe',
+       'email': 'john@email.com',
+       'address': '123 Main St, Anytown, USA',
+       'phone': '555-1234'
+   })
+
+# Insert multiple documents
+quickStartCollection.insert_many([
+    {
+        'name': 'Jane Smith',
+        'email': 'jane@email.com',
+        'address': '456 Elm St, Othertown, USA',
+        'phone': '555-5678'
+    },
+    {
+        'name': 'Alice Johnson',
+        'email': 'alice@email.com',
+        'address': '789 Oak St, Sometown, USA',
+        'phone': '555-8765'
+    }
+])`}
+                      
+
+
+ + {/* Step 7: Read documents */} +
+

+ Step 7: Read documents +

+ +
+
+                {`# Read all documents
+for document in quickStartCollection.find():
+    print(document)
+
+# Read a specific document
+singleDocumentReadResult = quickStartCollection.find_one({'name': 'John Doe'})
+    print(singleDocumentReadResult)`}
+                      
+
+
+ + {/* Step 8: Run aggregation pipeline query */} +
+

+ Step 8: Run aggregation pipeline query +

+ +
+
+                {`pipeline = [
+    {'$match': {'name': 'Alice Johnson'}},
+    {'$project': {
+        '_id': 0,
+        'name': 1,
+        'email': 1
+    }}
+]
+
+results = quickStartCollection.aggregate(pipeline)
+print("Aggregation results:")
+for eachDocument in results:
+    print(eachDocument)`}
+                      
+
+
+
+ ): ( + // Keep your existing content for other menu items +
+
+

+ Getting Started with {selectedGettingStartedItem} +

+

+ Welcome to the {selectedGettingStartedItem} guide. This + section will help you get up and running quickly. +

+ +

+ Step 1: Installation +

+
+ + # Installation instructions for{" "} + {selectedGettingStartedItem} + +
+ +

+ Step 2: Configuration +

+

+ Configure your environment for optimal use with + DocumentDB. +

+ +

+ Step 3: First Steps +

+

+ Start building with DocumentDB using{" "} + {selectedGettingStartedItem}. +

+
+
+ )} +
+
+
+
+ ); + } + + if (currentPage === "api-reference") { + return ( +
+ {/* Background elements */} +
+
+
+
+
+ +
+ {/* Left Sidebar */} +
+ {/* Header */} +
+ +

Operator Docs

+
+ + {/* Menu Items */} +
+ +
+
+ + {/* Main Content */} +
+
+
+

+ {selectedOperator} +

+
+

+ List of supported {selectedOperator} operators. Detailed + usage samples coming soon! +

+
+ + {/* Content based on selected operator */} + {selectedOperator === "Accumulator" ? ( +
+

+ Accumulator Operators +

+
+ {[ + "$avg", + "$bottom", + "$bottomN", + "$count", + "$first", + "$firstN", + "$last", + "$lastN", + "$max", + "$maxN", + "$median", + "$min", + "$minN", + "$stdDevPop", + "$stdDevSamp", + "$sum", + "$top", + "$topN", + ].map((operator) => ( + + ))} +
+
+ ) : selectedOperator === "Aggregation" ? ( +
+

+ Aggregation Operators +

+
+ {[ + "$addFields", + "$bucket", + "$changeStreams", + "$collstats", + "$convert", + "$count", + "$densify", + "documents", + "$facet", + "$fill", + "$geoNear", + "$group", + "$indexStats", + "$isNumber", + "$lookup", + "$match", + "$merge", + "$out", + "$redact", + "$replaceWith", + "$sample", + "$set", + "$skip", + "$sort", + "$sortByCount", + "$toBool", + "$toDate", + "$toDecimal", + "$toDouble", + "$toInt", + "$toLong", + "$toObjectId", + "$toString", + "$unset", + "$unwind"].map( + (operator) => ( + + ), + )} +
+
+ ) : selectedOperator === "Arithmetic Expression" ? ( +
+

+ Arithmetic Expression Operators +

+
+ {[ + "$abs", + "$add", + "$ceil", + "$divide", + "$exp", + "$floor", + "$ln", + "$log", + "$log10", + "$mod", + "$multiply", + "$pow", + "$round", + "$sqrt", + "$subtract", + "$trunc", + ].map((operator) => ( + + ))} +
+
+ ) : selectedOperator === "Array Expression" ? ( +
+

+ Array Expression Operators +

+
+ {[ + "$arrayElemAt", + "$arrayToObject", + "$concatArrays", + "$filter", + "$in", + "$indexOfArray", + "$isArray", + "$objectToArray", + "$reverseArray", + "$map", + "$range", + "$reduce", + "$slice", + "$sortArray", + "$zip", + ].map((operator) => ( + + ))} +
+
+ ) : selectedOperator === "Array Query" ? ( +
+

+ Array Query Operators +

+
+ {["$all", "$elemMatch", "$size"].map((operator) => ( + + ))} +
+
+ ) : selectedOperator === "Array Update" ? ( +
+

+ Array Update Operators +

+
+ {[ + "$addToSet", + "$each", + "$pop", + "$position", + "$", + "[]", + "[]", + "$pull", + "$pullAll", + "$push", + "$slice", + "$sort", + ].map((operator) => ( + + ))} +
+
+ ) : selectedOperator === "Bitwise" ? ( +
+

+ Bitwise Operators +

+
+ {["$bitand", "$bitnot", "$bitor", "$bitxnor"].map( + (operator) => ( + + ), + )} +
+
+ ) : selectedOperator === "Bitwise Query" ? ( +
+

+ Bitwise Query Operators +

+
+ {[ + "$bitsAllClear", + "$bitsAllSet", + "$bitsAnyClear", + "$bitsAnySet", + ].map((operator) => ( + + ))} +
+
+ ) : selectedOperator === "Bitwise Update" ? ( +
+

+ Bitwise Update Operators +

+
+ {["$bit"].map((operator) => ( + + ))} +
+
+ ) : selectedOperator === "Boolean Expression" ? ( +
+

+ Boolean Expression Operators +

+
+ {["$and", "$not", "$or"].map((operator) => ( + + ))} +
+
+ ) : selectedOperator === "Comparison Query" ? ( +
+

+ Comparison Query Operators +

+
+ {[ + "$cmp", + "$eq", + "$gt", + "$gte", + "$in", + "$lt", + "$lte", + "$ne", + "$nin", + ].map((operator) => ( + + ))} +
+
+ ) : selectedOperator === "Conditional Expression" ? ( +
+

+ Conditional Expression Operators +

+
+ {["$cond", "$ifNull", "$switch"].map((operator) => ( + + ))} +
+
+ ) : selectedOperator === "Date Expression" ? ( +
+

+ Date Expression Operators +

+
+ {[ + "$dateAdd", + "$dateDiff", + "$dateFromParts", + "$dateFromString", + "$dateSubtract", + "$dateToParts", + "$dateToString", + "$dayOfMonth", + "$dayOfWeek", + "$dayOfYear", + "$hour", + "$isoDayOfWeek", + "$isoWeek", + "$isoWeekYear", + "$millisecond", + "$minute", + "$month", + "$second", + "$week", + "$year" + ].map((operator) => ( + + ))} +
+
+ ) : selectedOperator === "Data Size" ? ( +
+

+ Data Size Operators +

+
+ {["$binarysize", "$bsonsize"].map((operator) => ( + + ))} +
+
+ ) : selectedOperator === "Element Query" ? ( +
+

+ Element Query Operators +

+
+ {["$exists", "$type"].map((operator) => ( + + ))} +
+
+ ) : selectedOperator === "Evaluation Query" ? ( +
+

+ Evaluation Query Operators +

+
+ {["$expr", "$mod", "$regex", "$text"].map((operator) => ( + + ))} +
+
+ ) : selectedOperator === "Field Update" ? ( +
+

+ Field Update Operators +

+
+ {[ + "$currentDate", + "$inc", + "$max", + "$min", + "$mul", + "$rename", + "$set", + "$setOnInsert", + "$unset" + ].map((operator) => ( + + ))} +
+
+ ) : selectedOperator === "Geospatial" ? ( +
+

+ Geospatial Operators +

+
+ {[ + "$box", + "$center", + "$centerSphere", + "$geoIntersects", + "$geoWithin", + "$geometry", + "$maxDistance", + "$minDistance", + "$near", + "$nearSphere", + "$polygon", + ].map((operator) => ( + + ))} +
+
+ ) : selectedOperator === "Literal Expression" ? ( +
+

+ Geospatial Operators +

+
+ {[ + "$literal", + ].map((operator) => ( + + ))} +
+
+ ) : selectedOperator === "Logical Query" ? ( +
+

+ Logical Query Operators +

+
+ {["$and", "$nor", "$not", "$or"].map((operator) => ( + + ))} +
+
+ ) : selectedOperator === "Miscellaneous" ? ( +
+

+ Miscellaneous Operators +

+
+ {["$getField", "$sampleRate", "$comment", "$natural", "$rand"].map((operator) => ( + + ))} +
+
+ ) : selectedOperator === "Object Expression" ? ( +
+

+ Object Expression Operators +

+
+ {["$mergeObjects", "$objectToArray", "$setField"].map( + (operator) => ( + + ), + )} +
+
+ ) : selectedOperator === "Projection" ? ( +
+

+ Projection Operators +

+
+ {["$elemMatch", "$meta", "$slice"].map((operator) => ( + + ))} +
+
+ ) : selectedOperator === "Timestamp Expression" ? ( +
+

+ Timestamp Expression Operators +

+
+ {["$tsSecond", "$tsIncrement"].map((operator) => ( + + ))} +
+
+ ) : selectedOperator === "Set Expression" ? ( +
+

+ Set Expression Operators +

+
+ {[ + "$allElementsTrue", + "$anyElementTrue", + "$setDifference", + "$setEquals", + "$setIntersection", + "$setIsSubset", + "$setUnion" + ].map((operator) => ( + + ))} +
+
+ ) : selectedOperator === "Variable Expression" ? ( +
+

+ Variable Expression Operators +

+
+ {["$let"].map((operator) => ( + + ))} +
+
+ ) : selectedOperator === "Window" ? ( +
+

+ Window Operators +

+
+ {[ + "$shift", + "$covariancePop", + "covarianceSamp", + "$denseRank", + "$derivative", + "$documentNumber", + "$expMovingAvg", + "$integral", + "$linearFill", + "$locf", + "$rank" + ].map((operator) => ( + + ))} +
+
+ ) : ( + /* Sample content for other operators */ +
+
+

+ Overview +

+

+ The {selectedOperator} category provides powerful + operators for document manipulation and querying. These + operators are essential for building complex database + operations and data transformations. +

+
+

+ Example usage: +

+ + db.collection.find( + {`{${selectedOperator.toLowerCase()}_operator: value}`}) + +
+
+ +
+

+ Common Operators +

+
+ {[1, 2, 3].map((i) => ( +
+

+ Operator {i} +

+

+ Description of operator {i} functionality and use + cases. +

+
+ + {`{ $operator${i}: { field: "value" } }`} + +
+
+ ))} +
+
+ +
+

+ Best Practices +

+
    +
  • + + + Always validate input parameters before using{" "} + {selectedOperator.toLowerCase()} operators + +
  • +
  • + + + Consider performance implications when chaining + multiple operators + +
  • +
  • + + + Use appropriate indexing strategies to optimize{" "} + {selectedOperator.toLowerCase()} queries + +
  • +
+
+
+ )} +
+
+
+
+ ); + } + + if (currentPage === "architecture") { + return ( +
+ {/* Background elements */} +
+
+
+
+
+ +
+ {/* Header with back button */} +
+
+ +
+ + {/* Main Content */} +
+
+

+ DocumentDB Technical Architecture +

+ + {/* JSON Construction Graphic */} +
+ {/* Main container with glow effect */} +
+ {/* Background glow */} +
+ + {/* JSON Document container */} +
+ {/* JSON Content */} +
+
{`{`}
+
+ "status":{" "} + "building" + , +
+
+ "progress":{" "} + 75 + , +
+
+ "architecture":{" "} + {`{`} +
+
+ "layers":{" "} + [ +
+
+ "DocumentDB API", +
+
+ "DocumentDB Core", +
+
+ "DocumentDB Gateway" +
+
+ ], +
+
+ "coming_soon":{" "} + true +
+
+ {`}`} + , +
+
+ "tools":{" "} + [ + + 🔨 + + + ⚙️ + + + 🔧 + + ] +
+
{`}`}
+
+ + {/* Construction helmet on JSON */} +
+ 👷‍♂️ +
+ + {/* Construction cone */} +
+ 🚧 +
+ + {/* Blueprints */} +
+ 📐 +
+ + {/* Floating construction particles */} +
+
+
+ + {/* Progress indicator */} +
+
+
+
+
+
+
+
+
+
+ +

+ We're building something amazing! The technical architecture + documentation is coming soon. +

+ +
+
+
+
+
+
+
+
+
+
+ ); + } return (
@@ -40,86 +2439,137 @@ export default function Docs() {
{/* Header */}
-

- {articleContent.landing.title} +

+ Documentation

- {articleContent.landing.description} + Everything you need to build with DocumentDB - from getting started + guides to deep architectural insights

- {/* Documentation Grid */} + {/* Documentation Grid - Updated to 2x2 layout with 25% larger blocks */}
- {articleContent.landing.links.map((item) => { - const isReference = item.link === "/docs/reference"; - - if (isReference) { - return ( - -
-
-
-
- - - -
-

- {item.title} -

-
-
- - ); - } - - return ( - -
-
-
-
- - - -
-

- {item.title} -

-
-
- - ); - })} + {/* Getting Started */} +
setCurrentPage("getting-started")} + > +
+
+
+
+ + + +
+

+ Getting Started with DocumentDB +

+
+
+
+ + {/* API Reference */} +
setCurrentPage("api-reference")} + > +
+
+
+
+ + + +
+

+ API Reference Docs +

+
+
+
+ + {/* PostgreSQL Extension API */} +
setCurrentPage("postgres-api")} + > +
+
+
+
+ + + +
+

+ Postgres Extension API Docs +

+
+
+
+ + {/* Architecture */} +
setCurrentPage("architecture")} + > +
+
+
+
+ + + +
+

+ Architecture under the hood +

+
+
+