Integrate MongoDB with Go
This quickstart guide will help you to integrate your Go application with MongoDB service on App42 PaaS.
Kontena – Kontena is a lightweight container that will run your apps and services in an isolated and secured manner. You can specify the power of the Kontena while setting up infra or creating services. One Kontena power specifies to 256 MB Memory and 128 MHz CPU.
Service – Services in the App42 PaaS are add-on components which are needed in an App. App42 PaaS supports multiple services like SQL databases, NoSQL databases and more.
Once you have created a MongoDB service, you can configure your database in main.go file, so that it can be picked up automatically and you don’t need to set anything.
// Database URL and connection Object db, err := mgo.Dial("USER:PASSWORD@VM IP:VM PORT/DATABASE NAME")
You can also use our Sample Apps and extend it to suit your needs. Here is the link to Go MongoDB Sample App
$ app42 update Enter App Name: demo 1: Binary 2: Source Choose Upload Type [Binary]: 2 Updating Application... OK Operation is in progress, Please wait...- App deployed successfully.