0% found this document useful (0 votes)
25 views4 pages

Atlas Compass C Sharp Mongo Setup Guide

Uploaded by

jeronreijne
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
25 views4 pages

Atlas Compass C Sharp Mongo Setup Guide

Uploaded by

jeronreijne
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 4

Guide to setting up MongoDB development environment

About
This guide will walk you through setting up a MongoDB development environment including the
use of Atlas (cloud based database as a service or DBAS for Mongo), Compass (GUI application
for exploring your MongoDB data and running queries), C# Drivers and will show you basic CRUD
operations in C#.

Atlas
• Follow this guide to getting started with Atlas:
https://www.mongodb.com/resources/products/platform/mongodb-atlas-tutorial
o Follow guide through “Creating a cluster user” section
o You do not need to complete “Generating a database connection string” section
and after yet (you will come back to do that later
• Note: make sure the user you create has read/write access to your cluster
• Note: under the network configuration step, you may want to allow access from

anywhere:
Compass
• Download and install Compass:
https://www.mongodb.com/docs/compass/current/install/
• Connect to your Atlas cluster:
o You will need a database user (created in Atlas setup step)
o Go through the connection wizard to generate your connection string:

o Generate connection string:


o https://www.mongodb.com/docs/compass/current/connect/
• Create a new database and users collection in Compass:
C# Driver

• IMPORTANT NOTE: be careful with your database connection string. Best practice is to
store this in a configuration file that is not committed to your repo. If your connection
string is committed to a public repository, other users will have direct access to your
database.
• Docs: https://www.mongodb.com/docs/drivers/csharp/current/
• Quick Start: https://www.mongodb.com/docs/drivers/csharp/current/quick-start/
• Guide:
o Create a new C# project
o Add System.Configuration.ConfigurationManager NuGet packate to your project
o Add an app.config file to your project:

o Install MongoDB driver via NuGet package manager:

o Create a connection to your user collection:


o Using quick start and other resources, try to perform basic CRUD operations on
your MongoDB collection
o You can look at this Gist for CRUD examples:
https://gist.github.com/danpaul/98cd9099a53c8a16ea3d565c28af463d

You might also like