Flask + MongoDB Tutorial

In this tutorial, I’ll demonstrate how can you use Flask together with MongoDB.


We’ll use the following structure for our project

__init__.py # Flask app
database.py # Main database class
job.py # Job DB model
routes.py # Main page routes
main.html # Main page HTML template
requirements.txt # Requirements for running the application
Continue reading “Flask + MongoDB Tutorial”

Mongo Shell By Example

Start the mongo shell

Start the mongo shell by running mongo

Note: this will connect using the default port 27017. Use -p for specifying a different port.

You should get an output similar to the following

MongoDB shell version v4.0.3
connecting to: mongodb://
Implicit session: session { "id" : UUID("2323-8as8-23aa-8fsa") }
MongoDB server version: 4.0.3

From this moment on, everything you’ll type will be executed in the mongo shell.

Continue reading “Mongo Shell By Example”