Use MongoDB With Your Xamarin Apps


One of the most important decisions that you’ll make when designing an app is what type of database to use.

Not too long ago, the choice was limited to relational databases like SQL server. However, now NoSQL databases are on the scene with the benefits of allowing applications to handle large amounts of structured and unstructured data at the same time, the ability to easily model data as objects, and massively scale across servers.

MongoDB is a NoSQL database that stores documents in a binary JSON format that has been popular in the Node.js community for a while. Azure Cosmos DB is a fully managed cloud database. With just a few clicks you can configure a database that is 100% compatible with the MongoDB API.

Despite the popularity of MongoDB for Node.js solution, a fully supported and maintained driver for .NET exists. The driver is implemented in .NET Standard which means it is compatible with multiple platforms, including Xamarin.

This article will show you how to create your first Xamarin app using MongoDB! We’ll query data using LINQ, insert, and delete data. By the end of this article you’ll have the info you need to create MongoDB powered Xamarin apps yourself.

You can find all of the code for a demo app in this GitHub repo.

Set Up the Environment

For the purposes of this tutorial, our MongoDB will be hosted in Azure Cosmos DB.

First, to get your instance of Azure Cosmos DB set up and ready to use, follow the instructions on the Azure Cosmos DB documentation page. Create a free Azure account using this link if you don’t already have one set up.

The MongoDB.NET library enables the communication between Xamarin apps and the MongoDB. Search for

Report Story

Leave Your Comment