Pass the mongosh password inline instead of a bare -p - #70
Merged
guanzhousongmicrosoft merged 1 commit intoAug 25, 2026
Conversation
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 <guanzhou.song@gmail.com>
guanzhousongmicrosoft
approved these changes
Aug 25, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
A cold-start test that followed this page verbatim in a container failed on the connect step with an error that names neither authentication nor the real cause:
Cause
The page shows:
A bare
-pmakesmongoshprompt for the password. In a non-interactive shell there is nothing to type, so it sends an empty password. The resultingInvalid keygives no hint that it was an auth failure, let alone an empty-credential one.This matters here because the page explicitly caters to scripted and container use — it already tells the reader to drop
sudoin a container and to exportDEBIAN_FRONTEND=noninteractive. Someone following it in exactly that context is the person most likely to hit this.Fix
Show the inline form, and say why:
Verification
Against a live install (packages from the repository,
documentdb-setuprun, gateway up):-p, non-TTYMongoServerError: Invalid key-p '<PASSWORD>'inline{ ok: 1 }insertOne/findthen round-tripped normally.Related
The same trap exists in the documentdb.io article and is fixed there alongside several air-gapped install blockers found by the same test run: documentdb/documentdb.github.io (PR linked once opened).
Full disclosure: this line is my own from #69 — I promoted the credential-flag form ahead of the URI form to avoid percent-encoding, and traded a visible trap for a quieter one.