Skip to content

Fix non-functional sample code and remove orphaned stub pages - #71

Merged
guanzhousongmicrosoft merged 1 commit into
documentdb:mainfrom
GuanzhouSong:users/guanzhousong/docs-quality-fixes
Aug 25, 2026
Merged

Fix non-functional sample code and remove orphaned stub pages#71
guanzhousongmicrosoft merged 1 commit into
documentdb:mainfrom
GuanzhouSong:users/guanzhousong/docs-quality-fixes

Conversation

@GuanzhouSong

Copy link
Copy Markdown
Contributor

Six reviews (Opus 5, Opus 4.8, GPT-5.6 Sol — two repos each) scored the docs against a written standard derived from Diátaxis, the CloudNativePG layout, the PostgreSQL documentation guide, and failures reproduced against DocumentDB's own published pages.

Docs-repo mean: 20.7/50. All three reviewers described the same shape: a strong reference core (postgres-api/, api-reference/, documentdb-local/, kubernetes-operator/) attached to a decaying getting-started front door — which is where a new user lands.

One reviewer executed the samples against a live gateway instead of reading them. python-setup.md failed six different ways.


1. python-setup.md was not runnable

Line Failure
108 datetime.utcnow() used 43 lines before its importNameError on copy-paste
162 initialize_ordered_bulk_op() — removed in PyMongo 4.0
187 $vectorSearch passed to find()unknown top level operator: $vectorSearch. It is an aggregation stage and must be first in the pipeline
201 from documentdb_api import DocumentDBno such package, not on PyPI, not in this project
219 pymongo.errors.ConnectionError doesn't exist → AttributeError inside the error-handling example
250 try: whose body is only a comment → IndentationError

The documentdb_api block is deleted rather than repaired — there is nothing real to point it at.

2. The vector index could not be created as documented

createIndex rejects the cosmosSearchOptions spec:

Index type 'CosmosSearch' was requested, but the 'cosmosSearch' options were not provided.

Switched to the createIndexes runCommand form, which works, and the error string is now named so anyone who already hit it can find this page.

3. A security claim that was backwards

vscode-quickstart.md said: "You must set these when creating the container for authentication to work."

False, and it inverts a real risk. Omitting --username/--password starts the container with the built-in default_user / Admin100 — public credentials that authenticate. Verified live. The page now says so.

4. Stale prerequisites that fail confusingly

Node.js 14.x or later against a driver requiring >=20.19; Python 3.7+ against PyMongo requiring >=3.9.

5. 54 lines of empty catalogue

nodejs-setup.md had seven headings whose bodies were numbered topic lists 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.

6. Deletions

vscode-extension-guide.md — 268 lines the website already replaces with a redirect to the Quick Start, carrying 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) — invalid JSON, and as JavaScript it evaluates 2024-11-16 to 1997, yielding a 1970 date. Collapsed to a pointer.

Five orphan stubsaws-setup, azure-setup, gcp-setup, yugabyte-setup, mongodb-migration. Verified 0 references: absent from navigation.yml, unlinked from every page, yet live indexable URLs. Each is a title plus 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 that the website was patching at runtime (articleService.ts carried a .replace(/Micrtosoft/g, 'Microsoft')) — a band-aid over a source typo, now unnecessary.


Note on the review process

Two of six reviewers reported a "broken URI" containing ****** in this repo. That was the credential-redaction filter masking mongodb://user:pass@host in their own transcripts — ****** appears nowhere in the repo. Verified against raw bytes and discarded; one reviewer caught it independently. Nothing here was changed without confirming it in the actual file.

Related

documentdb/documentdb.github.io#161 — the website half: broken certificate path, the false sample-data default, an ARM-breaking mongosh repo URL, and the missing Docker lifecycle.

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 <guanzhou.song@gmail.com>

@guanzhousongmicrosoft guanzhousongmicrosoft left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Sample code failures reproduced; orphan stubs confirmed unreferenced. Approving.

@guanzhousongmicrosoft
guanzhousongmicrosoft merged commit 72a549d into documentdb:main Aug 25, 2026
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.

2 participants