Skip to content

About

mongosh scripts and operator notes for MongoDB. Storage stats, compaction, defrag, and replica-set tooling, plus TLS, Kerberos, and LDAP command notes.

Topics

Resources

Stars

32 stars

Watchers

10 watching

Forks

Latest commit

 

History

1,983 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

mongodb-scripts

A collection of MongoDB scripts and command notes.

Live scripts are in src/. They run under mongosh 1.10 / 2.10+ (mongosh --file and load()). Read the disclaimer before running anything outside a test environment.

Start here

  • src/ — operator scripts for storage, deletes, schema, latency, and cluster checks.
  • DB Storage tools — WiredTiger disk use. dbstats reports it. autoCompact, onlineDefrag, and indexCacheUtil act on or inspect the same storage.
  • mongosh scripting guide — read preference, sessions, async, and --eval behaviour that long-running scripts keep hitting.
  • Roadmap — planned work, plus the live and archived version of each script.

Howtos

  • Aggregation tips — pipelines for a rolling date window, oplog churn, and schema shape.
  • Howto: streaming sort — keep an ordered walk streaming, as niceDeleteMany does when it buckets _id values.
  • PCG32 — choose among pcg32, crypto.webcrypto.getRandomValues(), and Math.random().
  • Roll your own SRV records — publish TXT and SRV records for mongodb+srv:// in a zone you control.

Command notes

Auth and TLS

Topology and clients

  • Split-Horizon Topology testing — stand up a replica set with split horizons and check the external names.
  • gRPC — turn on the gRPC listener. The client is the legacy mongo shell from a Linux SSL build.
  • BI Connector reproductions — mongosqld 2.13.1 startup and MySQL connection strings, with and without SSL and auth.
  • VM ballooning detection — on Linux, detect the hypervisor and whether a ballooning driver is present.
  • Client handshake metadata — driver monitoring sockets, and the NetworkInterfaceTL-* and MongoDB Internal Client labels.

Operations

Legacy

The last dual-shell (mongo / mongosh) tree is the legacy mongo shell snapshot, cut 2026-09-01 at tag legacy-mongo-shell. It is unmaintained. Pair those files with archived mdblib.js v0.15.10.

About

mongosh scripts and operator notes for MongoDB. Storage stats, compaction, defrag, and replica-set tooling, plus TLS, Kerberos, and LDAP command notes.

Topics

Resources

Stars

32 stars

Watchers

10 watching

Forks

Releases

Packages

Used by

Contributors

Languages