# MongoDB ## Linux CLI The MongoDB CLI can be downloaded from [here](https://www.mongodb.com/try/download/shell). Once you get the link to the current version you can installed like so: ```sh curl -O https://downloads.mongodb.com/compass/mongosh-2.3.2-linux-x64.tgz tar xvf mongosh-2.3.2-linux-x64.tgz cd mongosh-2.3.2-linux-x64/bin ``` To connect to a server call `mnogosh` like this: ```sh ./mongosh mongodb://<IP Address>:<Port usually 27017> ``` To see available databases call `show dbs;`. To select a database call `use <database name>;`. To see available collections in the selected database call `show collections;`. To see all documents in a collection call `db.<collection name>.find().pretty();`. To modify an existing record call `db.<collection name>.update({"_id":ObjectId("<ID>")},{$set:{"<PROPERTY NAME>":"VALUE"}})`. ## Hack The Box Machines - [[Mongod Write-up|Mongod]] - [[Unified Write-up|Unified]]