>>23079
Like this
mongo --eval "printjson(db.serverStatus())"
mongo --eval 'db.mycollection.update({"name":"foo"},{$set:{"this":"that"}});' myDbName
mongosh "mongodb://user:pwd@localhost:27017/mybase" --authenticationDatabase admin
mongodb://user:password@localhost:27017/mydatabase?authSource=admin
In this example:
mongodb://: Protocol identifier.
user:password@: Authentication credentials (username:password).
localhost:27017: Host address (localhost) and port (27017) where MongoDB is running.
/mydatabase: Name of the database to connect to.
?authSource=admin: Optional query parameter specifying the authentication source (admin database).