mongodb

mongosh

[!NOTE|label:references:]

install

[!NOTE|label:references:]

  • universal

  • debain

  • centos

  • check info

configure

[!NOTE|label:references:]

[!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

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:]

get key name

[!NOTE|label:references:]

operation

comparison operators

[!NOTE|label:references:]

OPERATOR
DESCRIPTION

$eq

equal (=)

$gt

greater than >

$gte

greater or equal than (>=)

$in

in (in)

$lt

less than (<)

$lte

less or equal than (<=)

$ne

not equal ()

$nin

not in (not in )

Last updated

Was this helpful?