Docs Menu
Docs Home
/
Start with Guides

Add a MongoDB Driver

In this guide, you will learn how to add a MongoDB driver to your project.

Time required: 5 minutes

An environment configured for your programming language.

Tip

Use the language selector above to switch between languages.

Add the MongoDB .NET/C# driver using NuGet. Use MongoDB.Driver for all new projects.

  • .NET CLI

    dotnet add package MongoDB.Driver --version 2.17.0
  • Package Manager

    PM > Install-Package MongoDB.Driver -Version 2.17.0
  • Package Reference

    <PackageReference Include=MongoDB.Driver" Version="2.17.0" />

Add the MongoDB Go driver using go mod.

mkdir guides
cd guides
go mod init guides
go get go.mongodb.org/mongo-driver/mongo

Add the MongoDB Java driver to your project in one of the following ways:

  • If you are using Maven, add the following to your pom.xml dependencies list:

    <dependencies>
    <dependency>
    <groupId>org.mongodb</groupId>
    <artifactId>mongodb-driver-sync</artifactId>
    <version>4.7.0</version>
    </dependency>
    </dependencies>
  • If you are using Gradle, add the following to your build.gradle dependencies list:

    dependencies {
    implementation 'org.mongodb:mongodb-driver-sync:4.7.0'
    }

Once you configure your dependencies, ensure they are available to your project which may require running your dependency manager and refreshing the project in your IDE.

Add the MongoDB Node.js driver to your project using npm.

npm install mongodb

Add the MongoDB Python driver, Pymongo, using pip.

python3 -m pip install 'pymongo[srv]'

If you successfully completed the procedure in this guide, you have added a MongoDB driver to your project.

In the next guide, you'll learn how to retrieve data from MongoDB.

For other CRUD guides:

  • Read Data in MongoDB

  • Read Data from MongoDB With Queries

  • Read Data using Operators and Compound Queries

  • Insert Data into MongoDB

  • Update Data in MongoDB

  • Delete Data from MongoDB

What's Next
Read Data in MongoDB
10 mins

Without a query, retrieve documents in MongoDB.

Start Guide
Chapter 2
CRUD
  • Add a MongoDB Driver
  • Read Data in MongoDB
  • Read Data from MongoDB With Queries
  • Read Data using Operators and Compound Queries
  • Insert Data into MongoDB
  • Update Data in MongoDB
  • Delete Data from MongoDB