ATLAS

Atlas is a way to manage MongoDB, Part of MEAN stack. An other way to manage the MongoDB is MongoDB Compass.

installing ATLAS

atlas

Apparently I first have to create an MongoDB Atlas cluster. No idea yet what it is, but I’ll need it for connecting the database. Here follow steps:

  1. Install Atlas CLI

    1. I’ll take Chocolatey to do so, here are the steps to install Chocolatey.

        1. Run the following in an administrative CMD window:         @"%SystemRoot%\System32\WindowsPowerShell\v1.0\powershell.exe" -NoProfile -InputFormat None -ExecutionPolicy Bypass -Command "[System.Net.ServicePointManager]::SecurityProtocol = 3072; iex ((New-Object System.Net.WebClient).DownloadString('https://community.chocolatey.org/install.ps1'))" && SET "PATH=%PATH%;%ALLUSERSPROFILE%\chocolatey\bin"

    2. run choco install mongodb-atlas in and administrator CMD

    3. When prompted, enter A to confirm installation.

    4. Close and reopen your terminal after the installation to see the changes in your path.

    5. Verify successful Atlas CLI installation:

        1. Run the atlas command from any directory:

            atlas

            The response includes available commands and options for the Atlas CLI.

  1. To update Atlas:

    1. run choco upgrade mongodb-atlas

    2. run atlas --version to see the version

  1. Complete the following procedure to get started with Atlas.

    - just follow these steps (I chose my school mail here)

In the end I got Enter 'atlas cluster watch Cluster86907' to learn when your cluster is available. in my CMD. Looks like I can continue back to the tutorial.

don’t forget to add a gitignore:


node_modules

.env

Link to original

Atlas UI

Just login here

The UI is needed for the connection string. Otherwise you’ll get issues like this.

MongoDB Compass

MongoDB Compass is a way to manage MongoDB, Part of MEAN stack. An other way to manage the MongoDB is ATLAS.

install

  1. Download Community server here
  2. install mongosh
  3. in a terminal you can now type mongosh to activate the shell.
  4. run db.getMongo() to get the connection string.

add a new item to the db

just read this or press the ADD DATA button:

export

You need mongodb database tools for this. 5. download the zip 6. go to the mongodb installation folder 7. paste the zip into bin/ 8. add bin/ to path 9. run the following command in the folder where you want to export it to 240308 is the name of the export, and MaintenanceModule is the DB name.

mongodump --out 240308 --db MaintenanceModule --gzip

Mongo commando’s Backup maken:

mongodump --out <backupFolderName> --db <nameOfDatabase> --gzip

Backup terugzetten:

mongorestore --db <backupFolderName> --drop <backupFolderName> --gzip