From 7453779b50c4154a8da31addffd95ac9b8b2875a Mon Sep 17 00:00:00 2001 From: Guanzhou Song Date: Tue, 25 Aug 2026 16:10:02 -0400 Subject: [PATCH] Fix non-functional sample code and remove orphaned stub pages Six parallel reviews scored this repo against a written documentation standard. The reference core (postgres-api, api-reference, documentdb-local, kubernetes-operator) scored well; getting-started, where a new user lands, did not. One reviewer executed the samples against a live gateway rather than reading them, and python-setup.md failed six different ways. python-setup.md: datetime.utcnow() was used 43 lines before its import, so a copy-paste raised NameError; initialize_ordered_bulk_op() was removed in PyMongo 4.0; pymongo.errors.ConnectionError does not exist and raised AttributeError in the error-handling example itself; $vectorSearch was passed to find(), where it is rejected as an unknown top-level operator, rather than to aggregate() where it must be the first stage; a "proper cleanup" example had a try: whose body was only a comment, which is an IndentationError; and a PostgreSQL-integration example imported documentdb_api, a Python package that does not exist and is not on PyPI. The last one is deleted rather than repaired, since there is nothing to point it at. mongo-shell-quickstart.md: the vector index used the createIndex helper, which rejects the cosmosSearchOptions spec with "Index type 'CosmosSearch' was requested, but the 'cosmosSearch' options were not provided." Use the createIndexes runCommand form, which works, and name the error so anyone who already hit it can find this. vscode-quickstart.md claimed "You must set these when creating the container for authentication to work". That is false and inverts a real risk: omitting the credentials starts the container with the public default_user / Admin100, which authenticates. Say so instead. Also fixes invalid JSON (new Date() inside a json fence) and a "dataabse" typo. Prerequisites were stale in a way that produces confusing failures rather than clear ones: Node.js 14 against a driver requiring >=20.19, and Python 3.7 against PyMongo requiring >=3.9. nodejs-setup.md had 54 lines of empty catalogue -- seven headings whose bodies were numbered lists of topics with no content, promising bulk operations, transactions, testing and deployment guidance that does not exist. Replaced with a working CRUD example and one honest pointer. vscode-extension-guide.md is 268 lines the website already replaces with a redirect to the Quick Start, and it carried a hardcoded password123, a docker image rm that deletes the image it just told you to run, and "created_at": new Date(2024-11-16), which is invalid JSON and, as JavaScript, evaluates to 1997 and yields a 1970 date. Collapsed to a pointer. Deleted aws-setup, azure-setup, gcp-setup, yugabyte-setup and mongodb-migration. All five are referenced nowhere -- absent from navigation.yml and unlinked from any page -- yet remain live indexable URLs. Each is a title and a restated description with no procedure; gcp-setup is one sentence, azure-setup ends on a bare "## Setup" heading with nothing under it. A 15-word page ranking for a real query is worse than a 404. Removing azure-setup also retires the Micrtosoft typo the website was patching at runtime. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: f18515db-c52f-4197-aa50-d81359c7c763 Signed-off-by: Guanzhou Song --- getting-started/aws-setup.md | 12 - getting-started/azure-setup.md | 22 -- getting-started/gcp-setup.md | 8 - getting-started/mongo-shell-quickstart.md | 29 +- getting-started/mongodb-migration.md | 12 - getting-started/nodejs-setup.md | 72 ++--- getting-started/python-setup.md | 68 ++--- getting-started/vscode-extension-guide.md | 356 +--------------------- getting-started/vscode-quickstart.md | 8 +- getting-started/yugabyte-setup.md | 12 - 10 files changed, 81 insertions(+), 518 deletions(-) delete mode 100644 getting-started/aws-setup.md delete mode 100644 getting-started/azure-setup.md delete mode 100644 getting-started/gcp-setup.md delete mode 100644 getting-started/mongodb-migration.md delete mode 100644 getting-started/yugabyte-setup.md diff --git a/getting-started/aws-setup.md b/getting-started/aws-setup.md deleted file mode 100644 index 0f107ba..0000000 --- a/getting-started/aws-setup.md +++ /dev/null @@ -1,12 +0,0 @@ ---- -title: AWS Setup -description: Deploy and manage DocumentDB alongside AWS for a hybrid database strategy. ---- - -# Multi-cloud with AWS DocumentDB - -Deploy and manage DocumentDB alongside AWS for a hybrid database strategy. - -## Important Note - -This guide covers deploying the open-source DocumentDB on AWS infrastructure. This is distinct from Amazon's DocumentDB service, which is a different product. While both support MongoDB compatibility, they are separate implementations with different features and capabilities. diff --git a/getting-started/azure-setup.md b/getting-started/azure-setup.md deleted file mode 100644 index 3960be9..0000000 --- a/getting-started/azure-setup.md +++ /dev/null @@ -1,22 +0,0 @@ ---- -title: Azure Setup -description: Deploy and manage DocumentDB on Micrtosoft Azure for a fully managed experience. ---- - -# Multi-cloud with Azure - -Deploy and manage DocumentDB on Micrtosoft Azure for a fully managed experience. - -## Azure Integration Options - -1. Azure DocumentDB (recommended) - - Native DocumentDB integration - - Full MongoDB compatibility - - Azure-managed infrastructure - -2. Self-managed on Azure VMs - - Complete control over configuration - - Custom deployment options - - Manual management required - -## Setup diff --git a/getting-started/gcp-setup.md b/getting-started/gcp-setup.md deleted file mode 100644 index bfc619e..0000000 --- a/getting-started/gcp-setup.md +++ /dev/null @@ -1,8 +0,0 @@ ---- -title: GCP Setup -description: Deploy and manage DocumentDB on Google Cloud Platform using various deployment options. ---- - -# Multi-cloud with GCP - -Deploy and manage DocumentDB on Google Cloud Platform using various deployment options. diff --git a/getting-started/mongo-shell-quickstart.md b/getting-started/mongo-shell-quickstart.md index 222c39f..046cc69 100644 --- a/getting-started/mongo-shell-quickstart.md +++ b/getting-started/mongo-shell-quickstart.md @@ -163,21 +163,26 @@ Each index above is on a distinct set of keys, which matters: when you don't pas Note also that a unique index is not sparse unless you say so. Documents that lack the indexed field are all treated as sharing a single "missing" value, so the second such document violates uniqueness. Add `sparse: true` when the field is optional. -To create a vector index on an embedding field, use the `cosmosSearchOptions` index spec accepted by the DocumentDB gateway: +To create a vector index on an embedding field, use `createIndexes` via `runCommand`. The +`cosmosSearchOptions` spec is not accepted through the `createIndex` helper, which fails with +`Index type 'CosmosSearch' was requested, but the 'cosmosSearch' options were not provided.` ```javascript -db.products.createIndex( - { embedding: "cosmosSearch" }, - { - name: "vectorIndex", - cosmosSearchOptions: { - kind: "vector-ivf", - numLists: 100, - similarity: "COS", - dimensions: 3 +db.runCommand({ + createIndexes: "products", + indexes: [ + { + name: "vectorIndex", + key: { embedding: "cosmosSearch" }, + cosmosSearchOptions: { + kind: "vector-ivf", + numLists: 100, + similarity: "COS", + dimensions: 3 + } } - } -) + ] +}) ``` `dimensions` must match the length of the vectors you store and query — a query vector of a different length is rejected. Three is used here only to keep the example short; a real embedding field is typically 384, 768, or 1536 wide, depending on the model. diff --git a/getting-started/mongodb-migration.md b/getting-started/mongodb-migration.md deleted file mode 100644 index 949e887..0000000 --- a/getting-started/mongodb-migration.md +++ /dev/null @@ -1,12 +0,0 @@ ---- -title: MongoDB Migration Guide -description: This guide helps you migrate your existing MongoDB applications to DocumentDB while maintaining compatibility and leveraging PostgreSQL benefits. ---- - -# MongoDB to DocumentDB Migration Guide - -This guide helps you migrate your existing MongoDB applications to DocumentDB while maintaining compatibility and leveraging PostgreSQL benefits. - -## Overview - -DocumentDB provides full MongoDB wire protocol compatibility, making migration straightforward for most applications. This guide covers the migration process, considerations, and best practices for transitioning from MongoDB to DocumentDB. diff --git a/getting-started/nodejs-setup.md b/getting-started/nodejs-setup.md index 466285f..905781f 100644 --- a/getting-started/nodejs-setup.md +++ b/getting-started/nodejs-setup.md @@ -9,7 +9,7 @@ Learn how to set up and use DocumentDB with Node.js using the official MongoDB N ## Prerequisites -- Node.js 14.x or later +- Node.js 20.19 or later (required by the current `mongodb` driver) - npm or yarn package manager - DocumentDB installed and running - Docker installed (if set up is not completed yet) @@ -82,62 +82,36 @@ async function connect() { ``` 2. Document operations - - Insert operations - - Find operations - - Update operations - - Delete operations -## Working with Promises and Async/Await - -1. Promise-based operations -2. Async/await patterns -3. Error handling -4. Connection management - -## Advanced Features - -1. Bulk operations -2. Aggregation framework -3. Vector search -4. Geospatial queries -5. Change streams -6. Transactions - -## Error Handling - -1. Connection errors -2. Operation errors -3. Timeout handling -4. Retry strategies - -## Best Practices + ```javascript + const users = db.collection('users'); -1. Connection pooling -2. Query optimization -3. Bulk operations -4. Error handling -5. Security considerations + await users.insertOne({ name: 'John Doe', email: 'john@example.com', createdAt: new Date() }); + await users.insertMany([ + { name: 'Jane Smith', email: 'jane@example.com' }, + { name: 'Bob Johnson', email: 'bob@example.com' }, + ]); -## Sample Applications + await users.updateOne({ name: 'John Doe' }, { $set: { status: 'active' } }); + console.log(await users.findOne({ name: 'John Doe' })); + console.log(await users.countDocuments()); -1. Basic CRUD application -2. REST API with Express -3. Vector search example -4. Real-time applications with change streams + await users.deleteOne({ name: 'Bob Johnson' }); + ``` -## Testing + Always close the client when the process is done: -1. Setting up test environment -2. Unit testing with Jest/Mocha -3. Integration testing -4. Mock testing + ```javascript + await client.close(); + ``` -## Deployment +## Beyond CRUD -1. Development setup -2. Production considerations -3. Monitoring and logging -4. Performance optimization +Aggregation pipelines, vector search, geospatial queries and change streams use the +same syntax as the MongoDB shell. See the +[Mongo Shell Quick Start](https://documentdb.io/docs/getting-started/mongo-shell-quickstart/) +for worked examples, and the [API reference](https://documentdb.io/docs/api-reference/) +for the supported operator set. ## Next Steps diff --git a/getting-started/python-setup.md b/getting-started/python-setup.md index d46fbf1..f9eb5da 100644 --- a/getting-started/python-setup.md +++ b/getting-started/python-setup.md @@ -9,7 +9,7 @@ Learn how to set up and use DocumentDB with Python using the official MongoDB Py ## Prerequisites -- Python 3.7+ +- Python 3.9 or later (required by PyMongo 4.x) - pip package manager - DocumentDB installed and running (see [Pre-built Packages](https://documentdb.io/docs/getting-started/packages/)) - Docker (if DocumentDB is not set up yet) @@ -101,11 +101,13 @@ DocumentDB Local accepts TLS connections on the gateway port and requires authen 2. Document operations ```python + from datetime import datetime, timezone + # Insert a single document collection.insert_one({ 'name': 'John Doe', 'email': 'john@example.com', - 'created_at': datetime.utcnow() + 'created_at': datetime.now(timezone.utc) }) # Insert multiple documents @@ -145,12 +147,12 @@ DocumentDB Local accepts TLS connections on the gateway port and requires authen 2. DateTime ```python - from datetime import datetime + from datetime import datetime, timezone # Insert with timestamp collection.insert_one({ 'name': 'Event', - 'timestamp': datetime.utcnow() + 'timestamp': datetime.now(timezone.utc) }) ``` @@ -158,15 +160,13 @@ DocumentDB Local accepts TLS connections on the gateway port and requires authen 1. Bulk operations ```python - # Initialize bulk operations - bulk = collection.initialize_ordered_bulk_op() - - # Add operations - bulk.find({'status': 'pending'}).update({'$set': {'status': 'processed'}}) - bulk.find({'age': {'$lt': 18}}).delete() - - # Execute - result = bulk.execute() + from pymongo import UpdateMany, DeleteMany + + result = collection.bulk_write([ + UpdateMany({'status': 'pending'}, {'$set': {'status': 'processed'}}), + DeleteMany({'age': {'$lt': 18}}), + ]) + print(result.modified_count, result.deleted_count) ``` 2. Aggregation framework @@ -183,40 +183,33 @@ DocumentDB Local accepts TLS connections on the gateway port and requires authen ``` 3. Vector search - ```python - # Vector similarity search - results = collection.find({ - '$vectorSearch': { - 'queryVector': [0.1, 0.2, 0.3], - 'path': 'embeddings', - 'numCandidates': 100, - 'limit': 10 - } - }) - ``` -4. PostgreSQL Integration + `$vectorSearch` is an aggregation stage and must be the first stage in the + pipeline — it does not work inside `find()`. + ```python - # Access PostgreSQL features directly - from documentdb_api import DocumentDB - - # Initialize DocumentDB with PostgreSQL support - db = DocumentDB(client) - - # Execute SQL queries on BSON documents - result = db.sql_query( - "SELECT jsonb_path_query(data, '$.name') FROM collection WHERE data @? '$.age > 21'" - ) + results = collection.aggregate([ + { + '$vectorSearch': { + 'queryVector': [0.1, 0.2, 0.3], + 'path': 'embeddings', + 'numCandidates': 100, + 'limit': 10 + } + } + ]) ``` ## Error Handling 1. Connection errors ```python + from pymongo.errors import ConnectionFailure + try: client = pymongo.MongoClient(connection_string) client.admin.command('ping') - except pymongo.errors.ConnectionError as e: + except ConnectionFailure as e: print(f"Connection error: {e}") ``` @@ -250,9 +243,8 @@ DocumentDB Local accepts TLS connections on the gateway port and requires authen 3. Proper cleanup ```python - # Always close connections when done try: - # Your code here + collection.insert_one({'name': 'Example'}) finally: client.close() ``` diff --git a/getting-started/vscode-extension-guide.md b/getting-started/vscode-extension-guide.md index e6eaa71..f838da2 100644 --- a/getting-started/vscode-extension-guide.md +++ b/getting-started/vscode-extension-guide.md @@ -1,360 +1,16 @@ --- title: Visual Studio Code Extension Guide -description: The DocumentDB for VS Code extension is a powerful, open-source GUI that helps you browse, manage, and query DocumentDB and MongoDB databases across any cloud, hybrid, or local environment. +description: The DocumentDB for VS Code extension helps you browse, manage, and query DocumentDB and MongoDB databases from your editor. --- # DocumentDB for VS Code Extension -The [DocumentDB for VS Code extension](https://marketplace.visualstudio.com/items?itemName=ms-azuretools.vscode-documentdb) is a powerful, open-source GUI that helps you browse, manage, and query DocumentDB and MongoDB databases across any cloud, hybrid, or local environment. +The canonical guide is the **[Visual Studio Code Quick Start](https://documentdb.io/docs/getting-started/vscode-quickstart/)** — start there to install the extension, connect to a local instance, and create your first collection. -## Overview +Install the extension from the [Visual Studio Marketplace](https://marketplace.visualstudio.com/items?itemName=ms-azuretools.vscode-documentdb), or from the command line: -DocumentDB for VS Code provides a developer-centric experience with minimal setup, offering universal support for both DocumentDB and MongoDB databases. Whether you're working with cloud-based, hybrid cloud, on-premises, or local instances, this extension provides the tools you need for efficient database management. - -## Key Features - -### Universal DocumentDB and MongoDB Support - -- **Flexible Connections**: Use connection strings or browse your cloud providers -- **Cross-Platform Service Discovery**: Connect to DocumentDB and MongoDB instances hosted with your provider -- **Wide Compatibility**: Full support for all DocumentDB and MongoDB databases - -### Developer-Centric Experience - -- **Multiple Data Views**: Inspect collections using Table, Tree, or JSON layouts with built-in pagination -- **Query Editing**: Execute find queries with syntax highlighting, auto-completion, and field name suggestions -- **Document Management**: Create, edit, and delete documents directly from VS Code -- **Data Import/Export**: Quickly import JSON files or export documents, query results, or collections - -## Installation - -### Prerequisites - -- [Visual Studio Code](https://code.visualstudio.com/) installed -- [Docker Desktop](https://www.docker.com/products/docker-desktop) (for running local DocumentDB instances) -- Basic familiarity with document databases -- MongoDB Shell (optional, for advanced commands) - -### Installation Steps - -1. **Open VS Code** -2. **Navigate to Extensions** (Ctrl+Shift+X or Cmd+Shift+X) -3. **Search for "DocumentDB for VS Code"** -4. **Click Install** -5. **Reload VS Code** if prompted - -### Alternative Installation - -Use the command palette: -1. Open VS Code Quick Open (Ctrl+P) -2. Paste: `ext install ms-azuretools.vscode-documentdb` -3. Press Enter - -## Getting Started - -1. **Start a local DocumentDB instance using Docker:** - - **Bash** - - ```bash - docker pull ghcr.io/documentdb/documentdb/documentdb-local:latest - docker tag ghcr.io/documentdb/documentdb/documentdb-local:latest documentdb - docker run -dt -p 10260:10260 --name documentdb-container documentdb --username admin --password password123 - docker image rm -f ghcr.io/documentdb/documentdb/documentdb-local:latest || echo "No existing documentdb image to remove" - ``` - - **PowerShell** - - ```powershell - docker pull ghcr.io/documentdb/documentdb/documentdb-local:latest - docker tag ghcr.io/documentdb/documentdb/documentdb-local:latest documentdb - docker run -dt -p 10260:10260 --name documentdb-container documentdb --username admin --password password123 - docker image rm -f ghcr.io/documentdb/documentdb/documentdb-local:latest; if ($LASTEXITCODE -ne 0) { echo "No existing documentdb image to remove" } - ``` - - > **Note:** We're using port `10260` to avoid conflicts with other local database services. You can use port `27017` (the standard MongoDB port) if you prefer. - -2. **Connect to DocumentDB using the VS Code extension:** - - Locate and select the DocumentDB icon in the primary VS Code sidebar on the left-hand side. - - Add a new connection to your DocumentDB: - - In the DocumentDB Connections area, locate and expand the **DocumentDB Local** node. - - Select the **New Local Connection** option. - - Confirm the port (default value `10260`), username, password, and choose the **Disable TLS/SSL** option. - - **Note:** TLS/SSL can be enabled, but this walkthrough skips those steps for simplicity. - - A new DocumentDB Local entry will be added and listed in your DocumentDB Connections area. - -## Core Features - -### Database and Collection Management - -#### Browsing Structure -- **Database View**: See all databases in your connection -- **Collection View**: Browse collections within each database -- **Document View**: Explore individual documents - -#### Creating Resources -```javascript -// Create a new database -// Right-click in the database explorer and select "Create Database" - -// Create a new collection -// Right-click on a database and select "Create Collection" - -// Create a new document -// Right-click on a collection and select "Create Document" -``` - -### Data Views - -#### Table View -- **Grid Layout**: View documents in a spreadsheet-like format -- **Sortable Columns**: Click column headers to sort data -- **Filtering**: Use the filter bar to search for specific values -- **Pagination**: Navigate through large datasets - -#### Tree View -- **Hierarchical Display**: See document structure as a tree -- **Expandable Nodes**: Click to expand/collapse nested objects -- **Field Navigation**: Easily navigate complex document structures - -#### JSON View -- **Raw JSON**: View documents in their native JSON format -- **Syntax Highlighting**: Color-coded JSON for better readability -- **Formatting**: Automatically formatted JSON display - -### Query Editor - -#### Basic Queries -```javascript -// Find all documents -db.collection.find({}) - -// Find documents with filters -db.collection.find({ status: "active" }) - -// Find documents with complex filters -db.collection.find({ - age: { $gte: 18 }, - status: { $in: ["active", "pending"] } -}) -``` - -#### Aggregation Pipelines -```javascript -// Basic aggregation -db.collection.aggregate([ - { $match: { status: "active" } }, - { $group: { _id: "$category", count: { $sum: 1 } } }, - { $sort: { count: -1 } } -]) - -// Complex aggregation with multiple stages -db.sales.aggregate([ - { $match: { date: { $gte: new Date("2024-01-01") } } }, - { $lookup: { from: "products", localField: "productId", foreignField: "_id", as: "product" } }, - { $unwind: "$product" }, - { $group: { _id: "$product.category", totalSales: { $sum: "$amount" } } } -]) -``` - -#### Query Features -- **Auto-completion**: Field names and operators are suggested as you type -- **Syntax Highlighting**: MongoDB query syntax is color-coded -- **Error Detection**: Invalid queries are highlighted -- **Query History**: Previous queries are saved for reuse - -### Document Management - -#### Creating Documents -```javascript -// Create a new document -{ - "name": "John Doe", - "email": "john@example.com", - "age": 30, - "created_at": new Date(2024-11-16), - "tags": ["user", "active"] -} +```bash +code --install-extension ms-azuretools.vscode-documentdb ``` -#### Editing Documents -- **Inline Editing**: Click on values to edit them directly -- **JSON Editor**: Use the JSON view for complex edits -- **Validation**: Automatic validation of JSON syntax -- **Undo/Redo**: Support for editing operations - -#### Deleting Documents -- **Single Document**: Right-click and select "Delete Document" -- **Bulk Operations**: Select multiple documents for deletion -- **Confirmation**: Confirmation dialog to prevent accidental deletions - -### Data Import/Export - -#### Importing Data -1. **JSON Files**: Import documents from JSON files -2. **CSV Files**: Import tabular data (with field mapping) -3. **Bulk Import**: Import large datasets efficiently - -#### Exporting Data -1. **Single Documents**: Export individual documents -2. **Query Results**: Export filtered query results -3. **Collections**: Export entire collections -4. **Formats**: Export as JSON, CSV, or BSON - -## Advanced Features - -### MongoDB Scrapbooks - -#### Creating Scrapbooks -```javascript -// Create a new scrapbook file (.mongo) -// This allows you to save and reuse queries - -// Example scrapbook content -db.users.find({ status: "active" }).limit(10) - -// You can include multiple queries -db.users.countDocuments({ status: "active" }) - -db.users.aggregate([ - { $match: { status: "active" } }, - { $group: { _id: "$department", count: { $sum: 1 } } } -]) -``` - -#### Running Scrapbooks -- **Execute All**: Run all queries in the scrapbook -- **Execute Selection**: Run only selected queries -- **Step-by-Step**: Execute queries one at a time - -### Index Management - -#### Viewing Indexes -```javascript -// View all indexes on a collection -db.collection.getIndexes() -``` - -#### Creating Indexes -```javascript -// Create a single field index -db.collection.createIndex({ "createdAt": 1 }) - -// Create a compound index -db.collection.createIndex({ "lastName": 1, "firstName": 1 }) - -// Create a unique index -db.collection.createIndex({ "email": 1 }, { unique: true }) - -// Create a geospatial index -db.collection.createIndex({ "location": "2dsphere" }) -``` - -#### Managing Indexes -- **View Index Details**: See index specifications and usage statistics -- **Drop Indexes**: Remove unnecessary indexes -- **Index Analysis**: Understand index usage patterns - -### Performance Monitoring - -#### Query Performance -```javascript -// Analyze query performance -db.collection.find({ email: "user@example.com" }).explain("executionStats") -``` - -#### System Statistics -```javascript -// Get database statistics -db.stats() - -// Get collection statistics -db.collection.stats() - -// Get server status -db.runCommand({ serverStatus: 1 }) -``` - -## Migration Support - -### MongoDB to DocumentDB Migration - -The VS Code extension is particularly useful for migrating from MongoDB to DocumentDB: - -#### Pre-Migration Analysis -1. **Schema Exploration**: Use the extension to understand your MongoDB schema -2. **Data Volume Assessment**: Check collection sizes and document counts -3. **Index Analysis**: Review existing indexes and their usage - -#### Migration Process -1. **Dual Connections**: Connect to both MongoDB and DocumentDB instances -2. **Data Comparison**: Use the extension to compare data between systems -3. **Validation**: Verify data integrity after migration - -#### Post-Migration Validation -1. **Query Testing**: Test your application queries in DocumentDB -2. **Performance Monitoring**: Compare query performance between systems -3. **Data Verification**: Ensure all data migrated correctly - -## Best Practices - -### Connection Management - -1. **Use Connection Strings**: Store connection strings securely -2. **Test Connections**: Verify connectivity before performing operations -3. **Monitor Performance**: Keep an eye on query performance - -### Query Optimization - -1. **Use Indexes**: Create appropriate indexes for your queries -2. **Limit Results**: Use `.limit()` for large result sets -3. **Project Fields**: Use projection to return only needed fields - -### Data Management - -1. **Backup Regularly**: Export important data regularly -2. **Validate Data**: Check data integrity after operations -3. **Use Transactions**: Use transactions for multi-document operations - -## Troubleshooting - -### Common Issues - -#### Connection Problems -- **Authentication**: Verify username, password, and authentication mechanism -- **Network**: Check firewall settings and network connectivity -- **SSL/TLS**: Ensure SSL certificates are valid - -#### Performance Issues -- **Indexes**: Review and optimize your index strategy -- **Query Patterns**: Analyze slow queries and optimize them -- **Connection Pooling**: Use appropriate connection pool settings - -#### Data Issues -- **JSON Syntax**: Validate JSON syntax in documents -- **Data Types**: Ensure data types are compatible -- **Size Limits**: Check for document size limitations - -### Getting Help - -1. **Extension Documentation**: Check the extension's built-in help -2. **Community Support**: Join the [Discord community](https://discord.gg/vH7bYu524D) -3. **GitHub Issues**: Report bugs on the [extension repository](https://github.com/microsoft/vscode-documentdb) - -## Integration with Other Tools - -### Version Control -- **Git Integration**: VS Code's Git integration works with your database scripts -- **Scrapbook Versioning**: Version control your MongoDB scrapbooks -- **Configuration Management**: Store connection configurations in version control - -### Development Workflow -- **Local Development**: Use local DocumentDB instances for development -- **Staging Environment**: Connect to staging databases for testing -- **Production Monitoring**: Monitor production databases safely - -## Next Steps - -- Learn about [DocumentDB Features](https://documentdb.io/docs/reference/) for advanced capabilities -- Join our [Discord community](https://discord.gg/vH7bYu524D) for support and discussions -- Report issues and contribute on [GitHub](https://github.com/documentdb/documentdb) +For feature reference, issues, and release notes, see the [extension repository](https://github.com/microsoft/vscode-documentdb). \ No newline at end of file diff --git a/getting-started/vscode-quickstart.md b/getting-started/vscode-quickstart.md index 2da1b2b..100dffb 100644 --- a/getting-started/vscode-quickstart.md +++ b/getting-started/vscode-quickstart.md @@ -45,7 +45,9 @@ Get started with DocumentDB using the Visual Studio Code extension for a seamles ``` > **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 `` and `` with your desired credentials. You must set these when creating the container for authentication to work. + > + > **Note:** Replace `` and `` with your own credentials. If you omit `--username`/`--password` the container falls back to the built-in `default_user` / `Admin100` — these are public, so anyone who can reach the published port can authenticate as admin. Always set your own. + > > **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 @@ -60,7 +62,7 @@ Get started with DocumentDB using the Visual Studio Code extension for a seamles 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 dataabse and select "Create Collection..." + - 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 @@ -74,7 +76,7 @@ Get started with DocumentDB using the Visual Studio Code extension for a seamles { "name": "Test Document", "type": "example", - "created_at": new Date() + "created_at": { "$date": "2026-08-25T00:00:00Z" } } ``` diff --git a/getting-started/yugabyte-setup.md b/getting-started/yugabyte-setup.md deleted file mode 100644 index 0c85310..0000000 --- a/getting-started/yugabyte-setup.md +++ /dev/null @@ -1,12 +0,0 @@ ---- -title: YugabyteDB Setup -description: Learn how to use DocumentDB alongside YugabyteDB for a comprehensive database solution. ---- - -# DocumentDB Usage with YugabyteDB - -Learn how to use DocumentDB alongside YugabyteDB for a comprehensive database solution. - -## Overview - -YugabyteDB is a distributed SQL database that is PostgreSQL-compatible. Since DocumentDB is built on PostgreSQL, it can be integrated with YugabyteDB to combine the benefits of both systems.