MongoDB: Connect

Learn how to connect to a MongoDB database.

With our generic interface in place, it’s time to put all our theory into practice and see how to connect to MongoDB. For the purposes of this course, we will use MongoDB as our database of choice for experimenting and learning about interacting with databases.

Set up a struct

For this purpose, we will first set up a mongo package and then we will create a struct that will implement our DB interface.

Get hands-on with 1400+ tech skills courses.