mongosh 0.9.0

A high-performance MongoDB Shell implementation in Rust
Documentation
# MongoDB Shell (mongosh) Configuration File
# Configuration file uses TOML format
# Documentation: https://github.com/daleione/mongosh/blob/main/docs/config.md

# ============================================
# Connection Configuration
# ============================================
[connection]

# Named datasources with their connection URIs
# You can define multiple datasources and switch between them using -d flag
# Example: mongosh -d card_prod
[connection.datasources]
local = "mongodb://localhost:27017"

# Default datasource to use when -d flag is not specified
# If not set, will use the first available datasource or fall back to command-line URI
default_datasource = "local"

# Connection timeout in seconds
# Range: 1-300
timeout = 30

# Number of retry attempts on connection failure
# Range: 0-10
retry_attempts = 3

# Maximum connection pool size
# Range: 1-100
max_pool_size = 10

# Minimum connection pool size
# Range: 0-max_pool_size
min_pool_size = 2

# Connection idle timeout in seconds
# Range: 60-3600
idle_timeout = 300


# ============================================
# Display Configuration
# ============================================
[display]

# Output format
# Options:
#   - shell: MongoDB Shell compatible format (recommended)
#   - json: Compact JSON format
#   - json-pretty: Formatted JSON
#   - table: ASCII table format
#   - compact: Minimal summary
format = "shell"

# Enable colored output
# Options: true, false
color_output = true

# Number of results per page
# Range: 1-1000
page_size = 20

# Enable syntax highlighting
# Options: true, false
syntax_highlighting = true

# Show command execution time
# Options: true, false
show_timing = true

# JSON indentation (number of spaces)
# Range: 0-8
json_indent = 2


# ============================================
# History Configuration
# ============================================
[history]

# Maximum number of history entries
# Range: 0-10000 (0 means unlimited)
max_size = 1000

# History file path
# Supports ~ for home directory
file_path = "~/.mongosh_history"

# Persist history to file
# Options: true, false
persist = true


# ============================================
# Logging Configuration
# ============================================
[logging]

# Log level
# Options: error, warn, info, debug, trace
# Recommended: warn (production), debug (development)
level = "warn"

# Log file path (optional)
# Leave empty or comment out to output to stdout
# Example: "/var/log/mongosh/app.log"
# file_path = ""

# Include timestamps in logs
# Options: true, false
timestamps = true


# ============================================
# Named Query
# ============================================

# Named query allow you to save frequently used query with a short name
#
# Parameter Substitution:
#   $1, $2, $3...  - Positional parameters
#   $*             - Raw aggregation (for numbers: 18, 25, 30)
#   $@             - String aggregation (quoted: 'admin', 'user')
#
# Important:
#   - Use '$1' (with quotes) for string parameters: {name: '$1'}
#   - Use $1 (without quotes) for numeric parameters: {age: $1}
#   - Arguments support quotes for spaces: query user "John Doe" 25
#   - Chinese characters work: query user 张三 18
[named_query]
# Add your named query here
# simple = "db.collection.find()"