From 9103b0e362b2bcdd8c8fa871557448d95997c634 Mon Sep 17 00:00:00 2001 From: Guanzhou Song Date: Tue, 25 Aug 2026 13:29:51 -0400 Subject: [PATCH] Pass the mongosh password inline instead of a bare -p A cold-start test that followed this page verbatim in a container hit an unhelpful failure on the connect step: MongoServerError: Invalid key A bare -p makes mongosh prompt for the password. In a non-interactive shell there is nothing to type, so it sends an empty password, and the resulting error names neither authentication nor the empty credential. The page already caters to scripted and container use, so show the form that works there. Verified against a live install: bare -p in a non-TTY exits 1 with the error above; the inline form returns { ok: 1 }. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: f18515db-c52f-4197-aa50-d81359c7c763 Signed-off-by: Guanzhou Song --- getting-started/prebuilt-packages.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/getting-started/prebuilt-packages.md b/getting-started/prebuilt-packages.md index 1d2e6e5..3d680a0 100644 --- a/getting-started/prebuilt-packages.md +++ b/getting-started/prebuilt-packages.md @@ -65,10 +65,10 @@ Installing the packages puts files on disk. The setup wizard creates the Postgre sudo documentdb-setup --admin-user admin ``` -It prompts for the admin password; for servers and CI pass `--admin-password-file ` or `--admin-password-stdin` together with `--yes`. Then connect (`mongosh` is not shipped by these packages): +It prompts for the admin password; for servers and CI pass `--admin-password-file ` or `--admin-password-stdin` together with `--yes`. Then connect (`mongosh` is not shipped by these packages). A bare `-p` makes `mongosh` prompt, so pass the password inline in scripts — a non-interactive shell otherwise sends an empty one and fails with the unhelpful `MongoServerError: Invalid key`: ```bash -mongosh localhost:10260 -u admin -p --authenticationMechanism SCRAM-SHA-256 \ +mongosh localhost:10260 -u admin -p '' --authenticationMechanism SCRAM-SHA-256 \ --tls --tlsAllowInvalidCertificates --eval 'db.runCommand({ping: 1})' ```