EventJoin us at AWS re:Invent 2024! Learn how to use MongoDB for AI use cases. Learn more >>

MongoDB loves developers. And we want to make software engineers everywhere successful with building applications—whether that’s a serverless web app, a mobile game, an IoT integration, or any other application you can imagine.

Using MongoDB to store your data is easy with our idiomatic drivers and libraries. We officially support 13 programming languages; and we also have a strong community who has developed additional libraries and drivers to work with nearly every programming language that exists today. We embrace the polyglot developer—and many of our customers use MongoDB with multiple programming languages within the same application.

MongoDB is the most popular NoSQL databases and is widely adopted for storing and managing both structured and unstructured data. Data administrators, analysts, and programmers can use the programming language of their choice to optimize and manage data, and create highly performant applications.

All of MongoDB’s compatible programming languages


The languages officially supported and compatible with MongoDB are:

  1. C
  2. C++
  3. C#
  4. Go
  5. Java
  6. Kotlin
  7. Node.js
  8. PHP
  9. Python
  10. Ruby
  11. Rust
  12. Scala
  13. Swift

We also have many community created drivers.

Languages

C logo image

C

Even with many other high-level programming languages, C remains a strong choice for legacy and modern applications because of its performance and support for new features.

  1. Most major operating systems—like Windows, Mac, and Linux—are powered by C.
  2. C is also used for embedded systems, gaming animations, and many more real-world use cases.

Learn how you can connect MongoDB and C applications using the official driver, libmongoc.

C++ logo image

C++

Did you know MongoDB is written in C++? C++ is one of the fastest languages compared to other high-level languages like Python. C++, therefore, is widely used for search engines, IoT, and GUI-based applications. MongoDB provides an official driver to write C++ applications using the mongocxx driver.
C# logo image

C#

MongoDB and C# are a natural fit. Many developers love C# as a modern, type-safe, object-oriented programming language that compiles quickly. The MongoDB C# (.NET) official driver makes it easy to interact with data on MongoDB from any C# application, and our Atlas Device SDK for Unity is also popular. C# developers may also be interested in our .NET Analyzer, which makes it easy to understand and troubleshoot queries and aggregations directly inside Visual Studio and other tools, or in the MongoDB Provider for Entity Framework Core (EF Core), which allows developers to build modern applications using familiar EF Core APIs and design patterns.
Go logo image

Go

Go is a language that offers high performance and great memory management features. It’s used in large projects for the cloud, such as Kubernetes, because of its efficient concurrency handling.

Its data-friendly syntax, used with MongoDB’s flexible schema, makes a powerful combination to build high-performance applications.

You can get started with the MongoDB Go driver by following the Golang and MongoDB tutorial from our website.

Java logo image

Java

Java is known as the “write once, run anywhere” language because of its support for multiple platforms. This allows using MongoDB with Java to be a natural fit. Java’s object can map directly to MongoDB documents when using the native driver. In addition to the native driver, we also encourage the exploration of Spring data’s MongoDB integration. You can find out how to get started with this tutorial.
Kotlin logo image

Kotlin

Kotlin is a cross-platform language that interoperates fully with Java and the JVM, and can be used both for Android development and for server-side. Mobile developers can use the Atlas Device SDK for Kotlin, and server-side Kotlin developers can use the Kotlin Driver. To get started with Kotlin, refer to the Developer Center.
Node.js image logo

Node.js

Node.js renders JavaScript code outside of a browser, which enables software developers to build desktop applications and web servers. Node.js is built on Google Chrome’s V8 JavaScript engine and uses an event-driven, non-blocking I/O model.

It’s often used with MongoDB and other JavaScript front-end languages, such as Angular, to form the MEAN stack, or React, to form the MERN stack.

Using Node.js with MongoDB is a natural choice for JavaScript developers due to the JSON-like syntax that MongoDB uses.

MongoDB can support users utilizing our nodeJS driver (which is actually written in typescript!), Mongoose, the Prisma.io ORM, and others.

Php logo image

PHP

PHP is a server-side scripting language that’s used to build dynamic web pages and websites. Even with the presence of many other feature-rich languages, PHP still holds a strong place because of its gentle learning curve and welcoming community. PHP applications can be securely connected to different databases, including MongoDB.

Combined with MongoDB, PHP applications are highly scalable, robust, and offer high performance.

In addition to the MongoDB PHP driver, many libraries and framework extensions are available to help developers get started even more quickly, including the MongoDB Laravel framework integration, officially developed and maintained by MongoDB.

Python logo image

Python

Python is one of the most popular languages for data-intensive tasks and data science because of the many libraries for statistics, machine learning, and AI-related tasks. Python is also very easy to learn, with human-readable syntax and a large community full of resources for beginners.

MongoDB is a great fit for Python developers, whether you’re building a web application, conducting data analysis, or focused on operations. This is because Python stores data in a dictionary format, which is similar to the JSON-like format in which MongoDB stores data. Python also can parse JSON data using built-in methods in a single step. This makes data retrieval and storage faster and more efficient.

Connect MongoDB to Python applications using the official driver pymongo for basic and advanced CRUD (create, read, update, delete) operations, and use pymongoarrow to export MongoDB data to pandas dataframes, numpy arrays, csv, and parquet files.

Additionally, streamline your development with our Full Stack FastAPI App Generator available on our GitHub repository, offering an app skeleton to significantly reduce project setup time for a production grade web application.

Ruby logo image

Ruby

Ruby has been around since the mid-1990s, but really became popular for web developers in the early 2000s with the release of the Rails framework. The language is mostly known for its elegant syntax, which makes it easy to read in a natural way.

MongoDB has a native Ruby driver that follows that same paradigm, along with an official ORM (ODM) called Mongoid. It provides an efficient way to map Ruby objects to MongoDB entities. Find out how to build a Ruby on Rails application with MongoDB in this tutorial.

Rust logo image

Rust

Rust provides memory safety and supports concurrent programming.

Rust is a low-level programming language with high performance, memory safety, and concurrency. Rust is most often used with MongoDB to write game engines and embedded applications.

Rust is strictly typed, whereas MongoDB has a flexible schema, and users can experience both via our serde integration.

Read our introduction to MongoDB and Rust to learn more about how to use the MongoDB Rust driver to build scalable and high performance applications.

Scala logo image

Scala

Scala is an all-purpose language used for data processing, web development, and distributed computing. It’s used by data engineers and software developers alike. To process huge datasets, data engineers and data scientists often use Scala along with Apache Spark.

By using Scala with a NoSQL or document database like MongoDB, you can build scalable data-intensive applications with ease thanks to MongoDB’s powerful features, including aggregation pipeline and real-time analytics.

The MongoDB Scala driver provides official support for Scala applications. Using Scala and MongoDB for Spark-based projects, developers can build faster applications and perform advanced real-time analytics and machine learning.

Swift logo image

Swift

Swift is a powerful language for both mobile and server-side development. MongoDB allows Swift developers to have the best of both worlds: Use our Atlas Device SDK for Swift for mobile or use our Swift driver with Vapor to develop cross-platform web and mobile applications. An example application can be found here on our Github.

Conclusion

Below is the summary of the best languages that work with NoSQL databases like MongoDB using a native driver:

LanguageUse CaseNative Driver
CGaming, OS development, embedded systemslibmongoc
C++IoT devices, machine learning tools, game developmentmongocxx
C#Web application development, gaming appsMongoDB C#/.NET driver
GoCloud native applications, distributed web appsMongoDB Go driver
JavaEnterprise web development, AI and deep learningJava driver Java Reactive Streams
KotlinMobile development, back-end or full-stack development, multi-platform mobile developmentMongoDB Kotlin driver
Node.jsBig data analytics, real-time data apps, chatbotsMongoDB Node driver
PHPWeb development, image processing, CMS systemMongoDB PHP driver
PythonWeb scraping, IoT, AIPyMongo
RubyEcommerce applications, social networksMongoDB Ruby driver
RustOperating systems, distributed online servicesMongoDB Rust driver
ScalaData pipelines, data processing, real-time information processingMongoDB Scala driver
SwiftOffline capabilities, mobile applicationsMongoDB Swift driver

FAQs

What languages does MongoDB use?

MongoDB supports many languages that are widely used for various data-intensive applications, like Java, C, and C++ for web applications and gaming; Python and Scala for big data applications; Node.js, PHP, and C# for server-side scripting; and many others. See the full list of MongoDB-compatible languages.

Is MongoDB a programming language?

MongoDB is not a programming language. MongoDB is a general purpose document database (sometimes referred to as a NoSQL database) that uses the MongoDB Query Language (MQL) to store and retrieve data from various applications and perform various aggregations, analytics, and visualizations to make business sense of data.

Is MongoDB better than SQL?

MongoDB is a NoSQL database, i.e., Not Only SQL. Whether MongoDB is better or SQL is better all depends on the business purpose, the use case, and the way in which data is retrieved—and we believe developers should have the information they need to choose the best tool for the task. MongoDB supports many programming languages and is very suitable for storing and managing today’s growing amount of unstructured and semi-structured big data.

MongoDB’s database-as-a-service, MongoDB Atlas, provides support for multiple cloud providers, like AWS and Azure, and comes with many benefits. RDBMS systems like SQL are still widely adopted and mostly used for structured data. Most BI and big data tools rely on SQL.

Is MongoDB easy to learn?

MongoDB is easy to learn. Whether or not you have prior experience with any database, you can easily understand the concept behind MongoDB and, most importantly, its query language.

Our MongoDB Developer Center provides tutorials, videos, and quickstarts to learn MongoDB with the programming language of your choice.