Thursday 19 September 2019

CRUD API For MongoDB using GoLang

Introduction

While MongoDB has established itself as a preferred NoSQL database in last few years, Go language or in short Go, developed and backed by Google has gone up the ladder of popularity as a mainstay programming language during the same period almost. Being a beginner to both the worlds, today I will show you how to develop API for MongoDB CRUD operations using Go and official MongoDB Go driver.

Following are the things that our API achieves.
1. It reads a JSON object to add a document in a MongoDB collection.
2. It reads a document from MongoDB collection and display in JSON format.
3. It updates a document in a MongoDB collection.
4. It deletes a document from MongoDB collection.