mongo-driver is a rich MongoDB driver that allows developers to write applications that use MongoDB as the database. The Go application can talk easily with MongoDB for all its CRUD operations using the mongo driver. It is an open source implementation maintained by MongoDB and can be used and modified freely. We can think of it as a wrapper around the MongoDB API. Installing the package is similar to other go get commands. However, in this chapter, we'll introduce a new Go package tool called dep.
dep is a Go package installer tool similar to Python's pip or JavaScript's npm. Follow this web page to install the dep tool on various platforms: https://golang.github.io/dep/docs/installation.html.
Let's write a Go program that inserts The Dark Knight movie document into MongoDB. Follow these steps:
- Create...