1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
# MongoDB Shell (mongosh) Configuration File
# Configuration file uses TOML format
# Documentation: https://github.com/daleione/mongosh/blob/main/docs/config.md
# ============================================
# Connection Configuration
# ============================================
[]
# Named datasources with their connection URIs
# You can define multiple datasources and switch between them using -d flag
# Example: mongosh -d card_prod
[]
= "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
= "local"
# Connection timeout in seconds
# Range: 1-300
= 30
# Number of retry attempts on connection failure
# Range: 0-10
= 3
# Maximum connection pool size
# Range: 1-100
= 10
# Minimum connection pool size
# Range: 0-max_pool_size
= 2
# Connection idle timeout in seconds
# Range: 60-3600
= 300
# ============================================
# Display Configuration
# ============================================
[]
# Output format
# Options:
# - shell: MongoDB Shell compatible format (recommended)
# - json: Compact JSON format
# - json-pretty: Formatted JSON
# - table: ASCII table format
# - compact: Minimal summary
= "shell"
# Enable colored output
# Options: true, false
= true
# Number of results per page
# Range: 1-1000
= 20
# Enable syntax highlighting
# Options: true, false
= true
# Show command execution time
# Options: true, false
= true
# JSON indentation (number of spaces)
# Range: 0-8
= 2
# ============================================
# History Configuration
# ============================================
[]
# Maximum number of history entries
# Range: 0-10000 (0 means unlimited)
= 1000
# History file path
# Supports ~ for home directory
= "~/.mongosh_history"
# Persist history to file
# Options: true, false
= true
# ============================================
# Logging Configuration
# ============================================
[]
# Log level
# Options: error, warn, info, debug, trace
# Recommended: warn (production), debug (development)
= "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
= 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
[]
# Add your named query here
# simple = "db.collection.find()"