« Mongodb » : différence entre les versions

De Banane Atomic
Aller à la navigationAller à la recherche
Ligne 37 : Ligne 37 :
| Log directory || C:\Program Files\MongoDB\Server\6.0\log\
| Log directory || C:\Program Files\MongoDB\Server\6.0\log\
|}
|}
* Install the [https://www.mongodb.com/docs/database-tools/installation/installation-windows/ Database Tools] in {{boxx|C:\Program Files\MongoDB\Tools}}

Version du 8 mars 2023 à 10:44

Connect and authenticate

Bash.svg
# connect
mongo mongodb://localhost:27017
# alias
mongo

# connect and authenticate, use an environment variable to hide the password
mongo "mongodb://user:${DBPASSWORD}@<host>:<port>/admin?authSource=admin"

Authenticate

Fichier:Mongo.svg
use admin

db.auth("username", "pwd")

db.auth("username", passwordPrompt())

Compass

Installation

Windows

Ps.svg
choco install mongodb mongodb-shell
Key Value
Service name MongoDB
Data directory C:\Program Files\MongoDB\Server\6.0\data\
Log directory C:\Program Files\MongoDB\Server\6.0\log\