MongoDB Tutorials

In this detailed Resource page, we feature an abundance of MongoDB Tutorials!

MongoDB is a cross-platform document-oriented database system and it is free and open source software. Classified as a NoSQL database, MongoDB eschews the traditional table-based relational database structure in favour of JSON-like documents with dynamic schemas (MongoDB calls the format BSON), making the integration of data in certain types of applications easier and faster.

MongoDB supports field, range query, and regular expression searches. Queries can return specific fields of documents and also include user-defined JavaScript functions. Queries can also be configured to return a random sample of results of a given size. Fields in a MongoDB document can be indexed with primary and secondary indices.

MongoDB provides high availability with replica sets. A replica set consists of two or more copies of the data. Each replica set member may act in the role of primary or secondary replica at any time. All writes and reads are done on the primary replica by default. Secondary replicas maintain a copy of the data of the primary using built-in replication. When a primary replica fails, the replica set automatically conducts an election process to determine which secondary should become the primary. Secondaries can optionally serve read operations, but that data is only eventually consistent by default.

The below tutorials will teach you how to install MongoDB and how to use its operators, functions and techniques so that you can develop your own MongoDB based applications.

Note
If you wish to build up your MongoDB knowledge first, check out our MongoDB Tutorial – A Scalable NoSQL DB.

MongoDB Tutorials – Getting Started

Simple examples to get to know MongoDB, how to download and use it so that you can develop your own applications

  • MySQL vs. MongoDB: Choosing a Data Management Solution
    The goal of this tutorial is to provide a fair overview of the two data management solutions: mature and widely used relation database represented by MySQL and a new kid on the block, MongoDB, which in turn represents a new generation of data store.
  • MongoDB Installation – How to install MongoDB
    The NoSQL movement gave birth to a vast amount of different data stores to cover the needs of mostly any imaginable application: key/value stores, graph databases, document databases, etc. In this tutorial we are going to cover the distinguishing member of document data stores family.
  • How to Install MongoDB on Ubuntu
    in this tutorial we will see the installation of MongoDB on Ubuntu operating system.
  • How to Check the MongoDB Version
    In this tutorial we will see how to check the exact version of the installed MongoDB.
  • MongoDB Tutorial for Beginners
    In this post, we feature a comprehensive MongoDB Tutorial that integrates with a Java-based application. We will study some of the characteristics of this NoSQL Database and how it evolved across various versions, adding new features with improved scalability and performance. We will also develop a small Maven-based Java project in which we will run some of the sample queries with MongoDB driver for Java.
  • MongoDB Create / Drop Database Example
    In this example we shall learn how to create, manage and delete Databases in MongoDB.
  • MongoDB Show Databases Example
    MongoDB is a popular document-oriented NoSQL database developed by MongoDB Inc. In this post we are going to see different ways to list all the available databases. To give a foreword, a database in MongoDB is technically made up of different Collections.
  • MongoDB Search Example
    MongoDB provides standard library methods and powerful query and projection operators for querying data from collections. This article covers how to search or find documents in a collection, finding a single document in a collection, providing the search criteria, projections, querying inner fields, usage of different query operators and querying arrays.

MongoDB Tutorials – Operations

Examples on how to use MongoDB’s operators and techniques

  • MongoDB Sharding Guide
    Sharding is a technique used to split large amount of data across multiple server instances. Nowadays, data volumes are growing exponentially and a single physical server often is not able to store and manage such a mass.
  • MongoDB Replication Guide
    Replication is a foundational technique to keep your data safe (by providing redundancy) and highly available all the time (by providing multiple instances serving the exact copy of the data). Replication helps a lot to recover from hardware failure and prevent service interruptions.
  • MongoDB MapReduce Tutorial
    The Map/Reduce paradigm, firstly popularized by Google, has gotten a lot of traction these days, mostly because of the Big Data movement.
  • MongoDB Security, Profiling, Indexing, Cursors and Bulk Operations Guide
    In this post we are going to take a look on MongoDB security model, different types of indexes, query plans and profiling, server-side cursors and bulk operations.
  • MongoDB Index Strategies and Types of Indexes
    In this lesson we will discuss the types of indexes in MongoDB and the different strategies we can use to maximize the performance of our database and operations performed on it.
  • MongoDB Indexing Example
    In Mongo database an index is a data structure that holds the specific data of the documents. In this tutorial we will understand the Mongo database indexing to improve the performance of the search query.
  • MongoDB Full Text Search Tutorial
    In this tutorial we are going to explore the full-text search functionalities of MongoDB right from fundamentals. MongoDB uses text indexes to perform the different full-text search operations and is case sensitive.
  • MongoDB Geospatial Query Operators Example
    Geospatial queries, as the name indicates, are queries used to query data using the geological data. These queries help you find places within a specific geospatial area.
  • MongoDB Field Update Operators Tutorial
    In this tutorial we will understand the different Field Update Operators available in the Mongo database. Let’s study in brief the different ways in which these operators can be used.
  • MongoDB Evaluation Query Operators Example
    In this tutorial we will understand the different evaluation query operators available in the Mongo database. Let’s study in brief the different ways in which these operators can be used.
  • MongoDB Element Query Operators Example
    In this tutorial we will understand the different element query operators available in the Mongo database. Let’s study in brief the different ways in which these operators can be used.
  • MongoDB Logical Query Operators Example
    In this tutorial we will understand the different logical query operators available in the Mongo database. Let’s study in brief the different ways in which these operators can be used.
  • MongoDB Comparison Query Operators Example
    In this tutorial we will understand the different comparison query operators available in the Mongo database. Let’s study in brief the different ways in which these operators can be used.
  • MongoDB Array Query Operators Example
    In this tutorial we will see the different array query operators in the Mongo database. Let’s study in brief the different ways in which these operators can be used.
  • MongoDB Regular Expressions Example
    A regular expression or regex is a sequence of characters that explains a specific search pattern. In this tutorial we will learn how to use the regular expressions in the Mongo database.
  • MongoDB Collection Example
    In this tutorial we will understand the implementation of the collection in MongoDB. The idea is to understand how MongoDB works and deploy a highly scalable and performance-oriented database.
  • Java MongoDB Iterating through a Collection
    in this tutorial, we will show how to iterate the documents of a Mongo collection using the Java driver.
  • Java MongoDB Select Collections Example
    In this tutorial, we will show how to select or query the documents of a Mongo collection using the Java driver.
  • MongoDB Delete Collection Example
    In this tutorial we will see how to delete a collection in MongoDB. Let’s study in brief the different ways in which a MongoDB collection can be deleted.
  • Java MongoDB Insert a Document Example
    In this tutorial you will learn how to insert the documents into a Mongo collection using the Java driver.
  • Java MongoDB Query Document Example
    In this tutorial we will show how to query the documents of a Mongo collection using the Java driver.
  • Java MongoDB Update Document Example
    In this tutorial we will show how to update the documents of a Mongo collection using the Java driver.
  • MongoDB Aggregation Example
    Aggregation in Mongo database is an operation that processes the multiple documents and returns a single computed result. In this tutorial we will learn how to use the different aggregation operations in the Mongo database.
  • MongoDb Aggregate Count Example
    In SQL or other relational databases, aggregation in the process that records and returns computed results like SUM MIN, MAX, AVG, and COUNT. MongoDb uses a similar concept but in a different fashion – it uses the concept of data processing pipelines.
  • MongoDB Create User and Assign Roles Example
    In order to keep up the data integrity authentication and authorization of a user is important to use a database. In this tutorial we will see how to set up more users in the MongoDB database and assign roles.
  • MongoDB Backup and Restore Example
    It is very important to protect the data against any damage if a disaster or the unforeseen outages. Thus, irrespective of the database type, it is important to keep up the regular data backups to make data available during the server crash or data corruption. In this tutorial we will see how to use the Backup and Restore features of the MongoDB database.

MongoDB Tutorials – Cursor Methods

Learn the usage of the most common Cursor Methods in MongoDB

  • MongoDB forEach() Example
    In this tutorial we will understand the cursor.forEach() method available in the Mongo database.
  • MongoDB batchSize() Example
    To increase the system performance it is important to retrieve the records from a database in batches. In Mongo world, it is pretty straightforward and in this tutorial, we will see the cursor.batchSize() method available in the Mongo database.
  • MongoDB close() and isClosed() Example
    To increase the system capacity it is important to instruct the Mongo database to close a connection and free the associated database resources. In Mongo world, it is pretty straightforward and in this tutorial, we will see the cursor.close() and cursor.isClosed() methods available in the Mongo database.
  • MongoDB count() and itcount() Example
    It is useful to count the number of records in a database. In Mongo world, this is pretty straightforward! So in this tutorial, we will see the count() and itcount() methods available in the Mongo database.
  • MongoDB explain() Example
    It is important to understand the information of a query plan. In Mongo world, it is pretty straightforward and in this tutorial, we will see the explain() method available in the Mongo database.
  • MongoDB hasNext() and next() Example
    In this tutorial we will see the hasNext() and the next() methods available in the Mongo database.
  • MongoDB hint() Example
    In this tutorial we will see the hint() method available in the Mongo database.
  • MongoDB limit() and skip() Example
    In this tutorial we will see the limit() and the skip() methods available in the Mongo database.
  • MongoDB max() and min() Example
    In this tutorial we will see the max() and min() methods available in the Mongo database.
  • MongoDB maxTimeMS() Example
    In this tutorial, we will see the maxTimeMS() method available in the Mongo database.
  • MongoDB pretty() Example
    In this tutorial we will see a Mongo database quick tip to print the result sets with proper formatting in the Mongo interactive shell.
  • MongoDB readPref() Example
    In this tutorial we will see the readPref() method available in the Mongo database.
  • MongoDB showRecordId() Example
    In this tutorial we will see the showRecordId() method available in the Mongo database.
  • MongoDB map() Example
    In this tutorial we will see the map() method available in the Mongo database.
  • MongoDB sort() Example
    In this tutorial we will learn how to sort the documents using the sort() method available in the Mongo database.
  • MongoDB size() Example
    In this tutorial we will learn how to implement the size() method available in the Mongo database.
  • MongoDB toArray() Example
    In this tutorial we will learn how to implement the toArray() method available in the Mongo database.

MongoDB Tutorials – When to use MongoDB

Learn the cases that MongoDB is the best choice for your application

  • MySQL vs MongoDB: Choosing a Data Management Solution
    In this short tutorial we try to take a look on two very popular data stores, traditional relation database represented by MySQL and document data store represented by MongoDB.
  • MongoDB vs MySQL Example
    These days, when it comes the time to select a database, one of the toughest decision for the developers is picking a relational or a non-relational database. While both are achievable alternatives, there are definite differences that developers must keep in mind when making a conclusion. In this tutorial we will learn the important differences between the MongoDB and the MySQL databases.
  • When to Use or Not to Use MongoDB
    In this tutorial we will see the pros and cons of using the MongoDB. MongoDB is a popular open-source document-oriented database developed by 10gen, later called the MongoDB Inc.

MongoDB Tutorials – Integrations

Learn how to use your MongoDB application with Java, 3rd party frameworks and helpful tools

  • MongoDB and Java Tutorial
    In this post we are going to cover the integration of MongoDB with applications written in Java. Our choice of Java is caused by its popularity but MongoDB provides bindings (or drivers) to many other languages, for complete list please refer to official documentation.
  • Java MongoDB Example
    The traditional database systems which provide their own Jdbc-compliant drivers, MongoDb comes with its own in-Jdbc driver called Mongo Java Driver. That means developers cannot use the standard Jdbc API to interact with the MongoDb from Java. In this tutorial we will show how to implement the MongoDb in Java.
  • Java MongoDB Authentication Example
    In this tutorial we will show how to start the Mongo database in secure mode and use the Java driver to connect and authenticate the Mongo database with the provided credentials.
  • Spring MVC CRUD using MongoDB Tutorial
    In this tutorial we will create a simple Spring MVC application that uses a document-oriented NoSQL database for its database layer. For this tutorial, we’ll perform the basic Create, Read, Update, and Delete database operations for managing the list of users.
  • Spring Data MongoDB Tutorial
    Spring is such framework which provides the ease of integration with a lot of different frameworks which makes it easy to develop an application using Spring. One such integration is integration of Spring with MongoDB.
  • Spring Data MongoDB REST Example
    In this tutorial I will show you how to develop a RESTful web application by using Spring and MongoDB without implementing boring uniform controllers.
  • MongoDB Shell Guide – Operations and Commands
    MongoDB shell is the best tool out there to discover MongoDB features and manage every single aspect of your server deployments, instances, databases, collections and documents.
  • MongoDB Node.js Tutorial
    In this example we will demonstrate how we can use Node.js to communicate with the MongoDB server.
  • MongoDB Import and Export JSON Data Example
    In this Mongo tutorial we will learn how to handle the Export and Import utilities provided by the Mongo database. Why JSON? Because it offers: Freeness, Internationalization, Extensibility to support array and objects, Intelligibility and Clarity and Interoperability between different tools which supports JSON.
  • MongoDB and JSP/Servlet Example
    In this tutorial we will learn how to connect the Servlet with the Mongo database. For this tutorial we’ll have a login form to validate the user’s login credentials in the Mongo database.

[undereg]

Back to top button