Skip to content

Code-Institute-Org/ci-mongo-template

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

19 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

CI logo

Welcome,

This is the Code Institute student template for using Mongo. We have preinstalled all of the tools you need to get started. It's perfectly ok to use this template as the basis for your project submissions.

You can safely delete this README.md file, or change it for your own project. Please do read it at least once, though! It contains some important information about this template and the extensions we use. Some of this information has been updated since the video content was created. The last update to this file was: May 23rd, 2024

IDE Reminders

Connecting your database

  • Connect to Mongo CLI on a IDE
  • navigate to your MongoDB Clusters Sandbox
  • click "Connect" button
  • select "Connect with the MongoDB shell"
  • select "I have the mongo shell installed"
  • choose mongosh (2.0 or later) for : "Select your mongo shell version"
  • choose option: "Run your connection string in your command line"
  • in the terminal, paste the copied code mongo "mongodb+srv://<CLUSTER-NAME>.mongodb.net/<DBname>" --apiVersion 1 --username <USERNAME>
    • replace all <angle-bracket> keys with your own data
  • enter password (will not echo **** on screen)

Other commands

Clear screen in Mongo Shell:

  • cls

Show all database collections:

  • show collections

Run your project

As we need to run a backend Python file, we should use the command python3 app.py, if your Python file is named app.py of course.

A button should appear to click: Open Preview or Open Browser.

In most cloudbased IDEs you have superuser security privileges by default. Therefore you do not need to use the sudo (superuser do) command in the bash terminal in any of the lessons.

To log into the Heroku toolbelt CLI:

  1. Log in to your Heroku account and go to Account Settings in the menu under your avatar.
  2. Scroll down to the API Key and click Reveal
  3. Copy the key
  4. In your IDE, from the terminal, run heroku_config
  5. Paste in your API key when asked

You can now use the heroku CLI program - try running heroku apps to confirm it works. This API key is unique and private to you so do not share it. If you accidentally make it public then you can create a new one with Regenerate API Key.


Happy coding!