mongodb
mongosh
[!NOTE|label:references:]
install
[!NOTE|label:references:]
universal
debain
centos
check info
configure
[!NOTE|label:references:]
Configure Settings Using a Configuration File
windows:
mongosh.cfg
same directory asmongosh.exe
osx:
/usr/local/etc/mongosh.conf
/opt/homebrew/etc/mongosh.conf
/etc/mongosh.conf
linux:
/etc/mongosh.conf
[!NOTE|label:references:]
auto-completion
local files
[!NOTE|label:references:]
logs
OPERATING SYSTEM PATH macOS
~/.mongodb/mongosh/<LogID>_log
Linux
~/.mongodb/mongosh/<LogID>_log
Windows
%LOCALAPPDATA%/mongodb/mongosh/<LogID>_log
command-line history
OPERATING SYSTEM PATH macOS
~/.mongodb/mongosh/mongosh_repl_history
Linux
~/.mongodb/mongosh/mongosh_repl_history
Windows
%UserProfile%/.mongodb/mongosh/mongosh_repl_history
--eval
--eval
execute command
list all
_id
eval command and show as json format
interactive mode
[!NOTE|label:references:]
connect to remote server
[!NOTE|label:references:]
utility
[!NOTE|label:references:]
show all tables
[!NOTE|label:references:]
list data
[!NOET|label:references:]
find the first data in table/collection
list all data in table/collection
get count
data size
query
[!NOTE|label:references:]
find data by
_id
list 2 columns
query fiels in conditions
[!NOTE|label:references:]
query in multiple values
get key name
[!NOTE|label:references:]
operation
comparison operators
[!NOTE|label:references:]
OPERATOR | DESCRIPTION |
---|---|
| equal (=) |
| greater than > |
| greater or equal than (>=) |
| in (in) |
| less than (<) |
| less or equal than (<=) |
| not equal () |
| not in (not in ) |
Last updated