You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
feat: support toArray no-op, runCommand, explain on read ops, and empty-statement no-op (#29)
Four mongosh compatibility fixes drawn from production gomongoFallback
telemetry. Each one was fronting a real fallback to mongosh; with these
in place ~9 distinct user-query shapes that previously fell back now run
natively in gomongo.
- toArray(): treat as a no-op cursor terminator alongside pretty(). The
result rows are already materialized into Result.Value, so the chained
call is purely cosmetic in mongo shell. Wild shape:
db.coll.find({…}).limit(N).toArray().
- db.runCommand({…}): generic escape hatch. Adds OpRunCommand and a
thin executor that hands the command body to mongo.Database.RunCommand
and returns the bson.D server response unchanged. Used in the wild
for the legacy `count` command form, and useful for any server
command without a dedicated typed wrapper.
- explain() on read operations: a trailing .explain() / .explain(verbosity)
on find / aggregate / count / distinct rewrites the operation into
{explain: <innerCommand>, verbosity: <v>} run via runCommand. Also
accepts the aggregate-option form db.coll.aggregate([…], {explain: true}).
Verbosity defaults to "queryPlanner" and is validated against the three
accepted values. Write-op explain (update/delete) is left out for now.
- Empty / comment-only input: gomongo previously rejected pure-comment
statements with "empty statement: …". mongosh treats them as no-op
successes; now gomongo does too via a new OpNoOp that the executor
handles by returning an empty Result.
Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
0 commit comments