From the course: Full Stack Web Development with Flask

Unlock this course with a free trial

Join today to access over 22,600 courses taught by industry experts.

Connecting to the database

Connecting to the database

- [Instructor] Connecting to the Database. In this video, we're going to connect to the MongoDB Database via the MongoEngine object. And then we're going to hook up a user collection to a very simple user model class. And we'll insert simple data documents into this collection, and also display the collection back to the view, just to make sure the connection, everything's working as we expect. So let's go into the code. Before we do anything further, I want to make sure that we create this database first. I'm using this MongoDB Compass Community GUI interface to create a database. You can also create it using the command line, but since we have the assistant up and running, we can just do that right on very quickly. So create the database by clicking this green button here. And the name of this database is called UTA if you remember from the previous video. This is the same add database name, and then it's going to ask…

Contents