Using the MongoDB Go driver

In order to use MongoDB in your Go programs, you should first have the MongoDB Go driver installed on your Unix machine. The name of the MongoDB Go driver is mgo and you can learn more information about the MongoDB Go driver by visiting,, and

As the driver is not part of the standard Go library, you should first download the required packages using the following two commands:

$ go get
$ go get

After that, you will be free to use it in your own Go utilities. If you try to execute the program without having the two packages on your Unix system, you will get an error message similar ...

Get Go Systems Programming now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.