Mongodb Professional Developer

Tags: MongoDB

Complete guide

Last updated 2022-01-10 | 4.1

- feel like a duck in water (MongoDB world)

What you'll learn

feel like a duck in water (MongoDB world)

* Requirements

* You only need the desire to learn. That's it!

Description

Why MongoDB?

MongoDB is a leading non-relational database. It is used by many well known, large companies like: Google, Facebook, eBay, UPS and many more.

Learn from a professional

I'm a certified MongoDB developer and certified MongoDB administrator.

You can verify my certificates using a link from the promo video. Here are the license numbers:

  • developer: 463-864-356
  • administrator: 106-358-385

I've been working with MongoDB for quite some time, and I can say that I know MongoDB very well.

MongoDB certification

Although this course was not designed for the needs of the certification process, its content, especially quizzes, can be a tremendous help in preparing to pass the MongoDB developer certificate. Read more about quizzes below.

Live course with support

This course will be upgraded based on your feedback as this course is for you and your thoughts, problems and questions are very important for me.

I will help you a much as I can. 

Quick overview

This course is designed to make you a real, professional MongoDB developer with deep understanding of many different MongoDB features. After this course you will know everything you need, to work with MongoDB comfortably. This course is a MongoDB complete training. 

Resources

So that you can follow all the queries executed during this course, I have attached a file that contains all the collections I've used. So you will be able to repeat every query and check everything in practice. You will be able to perform your own queries.

Quizzes

For many sections you will find Quizzes. These quizzes contain about 150 questions in total. These quizzes are designed to be hard. They are not there to make you feel good because you know the answer to every single question. They are there to remind you of some things, to draw your attention to certain cases and to make you a better developer at the end. And this is the goal of this course.

Homeworks

For two sections: CRUD and Aggregation you will find some homework. You will need to write some queries, to master your skills. For each homework you will find solutions, so you can compare your queries or just take a peep to help yourself out.

SQL backround

In some cases we will compare MongoDB to relational databases, to see the differences. This, I think, will be quite useful if you have a background in relational databases.

But you don't have to be familiar with relational databases at all to learn MongoDB

MongoDB version

This course is based on MongoDB 3.2. It is the newest stable release, ready for production.

Course version

Current version:       1.0.2         02.03.2017         Better voice for lectures from 20 to 28
                             1.0.1         31.01.2017          Improved sound for sections 2, 3 and 4

Work in progress

Closed captions                       17.04.2017         done for lectures from 1 to 33 (25%)



Who this course is for:

  • anyone who wants to learn the leading "non-relational" database
  • IT developers
  • IT architects

Course content

16 sections • 141 lectures

What is MongoDB? Preview 03:48

In this lecture we will discuss what MongoDB database is. We will also discuss the three very popular terms which try to describe MongoDB.

Main MongoDB features Preview 04:28

In this lecture we will be talking about the two main advantages of MongoDB.

MongoDB limitations Preview 03:45

In this lecture we will be talking about MongoDB's limitations. Don't worry, we will learn how to deal with them during this course.

MongoDB components Preview 01:34

In this lecture we will be talking about the components of MongoDB. We will focus on two most important of them:

  • mongod
  • mongo

MongoDB editions and versions Preview 02:34

In this lecture we will be talking about different MongoDB editions and versions. We will choose the MongoDB edition for us.

Operating systems Preview 01:53

MongoDB can be installed on many different operating systems. We will see the full list and we will choose two operating systems for us.

Installation: Ubuntu 14.04 LTS Preview 11:38

In this video we will be installing MongoDB on Ubuntu 14.04 LTS. If you want to install MongoDB on Windows, skip this lecture and go to lecture 9.

Installation: Ubuntu 14.04 LTS - all steps Preview 00:04

Installation: Windows Preview 05:36

In this video we will be installing MongoDB on Windows. After this video you will be ready for action!

Run, connect to and shutdown the MongoDB server Preview 09:12

In this lecture we will be talking about how to:

  • run
  • connect to 
  • shutdown 

the MongoDB server. 

We will discuss the most important options for mongod and mongo.

Client: the mongo shell Preview 08:02

In this lecture we will be talking about mongo. This is the default client, shipped with the MongoDB installation. After this video You will understand this client.

Client: Robomongo Preview 05:10

In this lecture we will be talking about Robomongo. This is a third party client that can be used to interact with the database. We will be using this client in section 10.

Quick overview Preview 01:09

In this short video we will explain what the data structures in MongoDB are. We will compare them with data structures used by relational databases.

Mongo: the first interaction with the data Preview 04:43

In this video we will interact with the MongoDB server in order to become more familiar with databases, collections and documents. We will become more familiar with the data representation before we discuss them in more detail.

Document in detail Preview 09:13

In this lecture we will discuss MongoDB documents in detail. We will be talking about text and binary representations of documents. We will be able to understand the difference between JSON and BSON. We will also discuss important BSON data types.

Collection in detail Preview 03:05

In this lecture we will discuss MongoDB collections in detail. We will focus mostly on polimorphism and how to create collections.

Mongo: databases, collections, documents Preview 09:25

As know we understand the data representation used by MongoDB, we know what databases, collections and documents are, time to interact with them.

Resources Preview 04:29

In this video we will be talking about the resources prepared for this course. We will import all the collections used during this course, so You will be able to repeat every query and check everything in practice.

resources.zip file Preview 00:13

Introduction Preview 02:27

In this video we will briefly discuss the methods used to perform CRUD operations. All of them will explained in detail in the next lectures.

Insert: method definition Preview 02:08

In this video we will discuss the insert() method, which is used to insert new documents into a collection.

Insert: inserting a single document Preview 06:08

In this video we will be talking about inserting single documents into the database. We will also discuss primary keys.

Insert: inserting many documents Preview 05:57

In this lecture we will be talking about how to insert many documents at the same time.

Insert: document restrictions Preview 04:18

In this lecture we will be talking about some very important restrictions that affect documents in MongoDB.

Find: methods definition Preview 02:05

In this video we will discuss the find() and findOne() methods, which are used to retrieve documents from the database.

Find: cursor Preview 12:37

The find() method returns always a cursor. In this video we will learn what a cursor is and how it works.

Find: basic operators Preview 10:08

In this video we will be talking about basic operators used for creating matching criteria. These operators are:

  • $eq
  • $ne
  • $gt
  • $gte
  • $lt
  • $lte
  • $in
  • $nin

Find: logical operators Preview 08:22

In this video we will be talking about logical operators. These operators are used to create more complex matching criterias. We will discuss:

  • $and
  • $or
  • $nor
  • $not

Find: document structure conditions Preview 09:47

As polymorphism allows us to store unstructured data we must know how to deal with this. In this video we will discuss two operators:

  • $exists
  • $type

Find: embedded documents Preview 06:22

As this is completely normal to have documents embedded within other documents, we will discuss in this video how to create conditions for embedded documents.

Find: $where Preview 07:10

In this video will be talking about a specific query operator, which is $where. We will discuss whether we should avoid it, and if so, why and how to do this.

Find: arrays Preview 12:40

Documents can contain arrays. In this video we will be learning how to create conditions for arrays. This lecture covers these operators:

  • $all
  • $size
  • $elemMatch

Find: projection Preview 06:31

In this lecture, we will be talking about projection, so the ability to limit returned data.

Find: projection operators Preview 11:06

In this video we will continue learning projection, but in this lecture we will focus on projection operators:

  • $
  • $elemMatch
  • $meta
  • $slice

Find: sorting Preview 08:31

It is very common that we want to retrieve sorted data from the database. In this video we will be learning how to do this.

Find: sorting unstructured data Preview 06:41

In this lecture we will be talking about sorting unstructured data. As polimorphism allows us to store any documents we want to, in the same collection, some documents can have values of different types in the same field or not have such a field at all.

Find: limit results Preview 08:50

In this lecture we will be talking about limiting the number of returned documents. This lecture covers two cursor methods:

  • cursor.limit()
  • cursor.skip(

Update: method definition Preview 02:00

In this video we will discuss the update() method, which is used to change existing documents.

Update: replacing the whole document Preview 04:10

In this short lecture we will be learning how to replace the whole document in a collection.

Update: modification od selected fields Preview 07:41

In this video we will be talking about how to modify the selected fields of a document. We will discuss these operators:

  • $set
  • $unset

Update: arithmetic modifications Preview 10:33

In this lecture we will be talking modifying numbers. We will discuss these operators:

  • $inc
  • $mul
  • $min
  • $max

Update: array - add new elements Preview 10:51

In this video we will be learning how to add new elements to an array. We will discuss these operators:

  • $addToSet
  • $push

Update: array - remove elements Preview 15:19

In this lecture we will be learning how to remove specific elements from an array. We will discuss these operators:

  • $pop
  • $pullAll
  • $pull

Update: array - specific elements Preview 11:09

In this lecture, we will be talking about modifying specific elements in arrays. We will be doing this using:

  • a number that specifies the position in an array
  • the special operator: $

Update: upsert Preview 08:27

In this video we will be talking about upserting documents. We will learn what upserting is, and what fields upserted documents contain.

Update: multiple documents Preview 04:26

In this video we will be learning how to modify multiple documents, as by default MongoDB modifies only single documents.

Remove: method definition Preview 01:43

In this video we will discuss the remove() method, which is used to change delete documents.

Remove: deleting in action Preview 09:00

In this video we will be learning how to delete documents from a collection. We will also learn how to delete the whole collection.

Inserting, modifying, deleting in 3.2 Preview 09:00

In this video we will be learning about new methods to insert, modify and delete documents, introduced in version 3.2. We will discuss:

  • insertOne()
  • insertMany()
  • updateOne()
  • updateMany()
  • deleteOne()
  • deleteMany()

Bulk operations (new in 3.2) Preview 08:00

In this lecture we will be talking about performing bulk operations, in other words, the ability to execute many operations using a single query. We will see how to do this, and we will learn why bulk operations rock!

Homework: tasks Preview 00:06

Homework: solutions Preview 00:06

Quiz

Introduction Preview 03:19

In this video we will learn what indexes are and what they are used for. We will learn how they speed up our queries.

Create, list and delete indexes Preview 12:02

In this lecture we will be learning about how to create, list and delete indexes in MongoDB. We will discuss these methods:

  • db.{collection}.createIndex()
  • db.{collection}.getIndexes()
  • db.{collection}.dropIndex()
  • db.{collection}.dropIndexes()

Single field index (+explain +hint) Preview 14:30

In this lecture we will discuss single field indexes in detail. To check how our indexes are used by our queries we will use the cursor.explain() method. We will learn how to interpret the results returned by this method. As MongoDB automatically chooses an index for our query, we will learn how to choose an index ourselves.

Single field index: sorting Preview 05:46

In this video we will be learning how indexes are used to sort our data. We will also discuss when this is possible and when it is not.

Index characteristics Preview 10:02

In this video we will be learning about the characteristics of indexes, using examples.

We will observe in action how indexes improve performance. We will also see what happend during index creation and what is the difference between creating indexes in the foreground and in the background.

Compound index Preview 06:57

In this video we will be learning how to create compound indexes and when these indexes are used. We will learn what index prefixes are.

Compound index: sorting Preview 06:16

In this video we will be talking about using compound indexes for sorting. We will learn when a compound index can be used for sorting and when it cannot.

Unique and sparse indexes Preview 13:16

In this video we will be learning about two special types of single and compound indexes:

  • unique indexes
  • sparse indexes

We will discuss how to create such indexes and what the consequences of creating such indexes are.

Multikey indexes Preview 08:00

Multikey index is not a separate type of index. In this leacture we will be learning what is and how it restricts the form of stored documents.

Covered query Preview 05:55

Covered queries are very fast! We will be learning when we can and how to write a covered query.

Special indexes Preview 01:00

In this lecture we will briefly discuss special types of indexes. They will be explained in detail in the next section.

Quiz

Full text search Preview 15:28

In this lecture we will be talking about full text search. We will learn what is full text search and what we must do in order to use it. We will discuss the $text operator. We will also learn about two key concepts:

  • stemming
  • stop words

Full text search: case sensitivity and diacritic characters Preview 05:17

As text contains capital letters and in many languages also diacritic characters, in this video we will be learning how to take them into account when writing our queries.

Full text search: compound index Preview 06:32

In this lecture we will be learning how to create and use compound text indexes.

Full text search: score and sorting Preview 11:42

In this lecture we will be learning how to sort results, returned by text search. We will be learning how MongoDB calculates a score for every document and how we can influence this process.

Full text search: restrictions and performance Preview 09:32

In this lecture we will discuss restrictions and performance considerations for text indexes. We will discuss size of a text index and a useful strategy called partitioning.

Geospatial support Preview 04:42

In this video we will be talking about two different surfaces supported by MongoDB:

  • flat
  • spherical

We will learn what is the difference beween these two.

We will also discuss different data representations that are used to represent geographical coordinates including legacy and GeoJson coordinates.

Geospatial support: 2d Preview 09:16

In this video we will discuss 2d support (flat surface). We will larn how to create queries using the $near and $geoWithin operators. We will see how to specify maximum and minimum distance for our searches.

We will also learn when not to use this type of surface and why.

Geospatial support: 2dsphere Preview 10:51

In this video we will be talking about 2dsphere indexes (spherical surface). We will write some queries using coordinates of simple points and real capitals. 

Quiz

Introduction Preview 01:51

In this video we will be talking what are the three main types of collections. We will also mention validation.

Create collection manually and primary index Preview 03:50

In this video we will be talking about manual collection creation. This is important as TTL collections and capped collections can be created only manually. We will see how to use the createCollection() method. We will use it to create a collection without primary key.

Capped collections Preview 15:06

In this lecture we will be talking about capped collections. We will learn how to create and configure a new capped collection. We will discuss how capped collections work. We will learn how to check if a collection is capped. We will also discuss some of the restrictions.

TTL collections Preview 11:47

In this lecture we will be talking about TTL collections. We will learn how to create apropriate index from a TTL collection using expireAfterSecond parameter. We will observe in action how this works and what is the maximum delay. We will also be talking about restrictions.

Document validaton: introduction Preview 03:25

In this video we will introduce document validation which is a new functionality. We will learn what validation means and how to define validation for our collections.

Document validation: validator Preview 13:22

In this lecture we will be talking how to define validation rules for our documents using the validator option for the createCollection() method. We will also learn which operators we cannot use to create validation rules. 

Document validaton: validation level Preview 05:59

In this video we will be talking about the validationLevel option, which is used to specify how strictly validation rules are applied to our documents. We will discuss all three levels:

  • off
  • strict
  • moderate

We will see the difference in practice.

Document validation: validation action Preview 03:31

In this video we will be talking about the validationAction option, which is used to specify what happens when validation rules are violated. 

Quiz

Introduction Preview 04:55

In this video we will discuss what data aggregation is. We will learn how to use the aggregate() method. We will learn how to define an aggregation pipeline and what it is. We will see the list of available aggregation stages.

$match Preview 06:13

In this lecture we will be talking about the the $match stage, which is responsible for filtering documents 
in the pipeline.

$project Preview 11:09

In this lecture we will be talking about the $project stage, which is similar to the projection parameter for the find() method. We will learn simple projections but we will also learn how to modify documents using this stage.

$redact Preview 12:57

In this lecture we will be talking about the $redact stage, which is used to change the shape of documents. We will use it in practice.

$group Preview 10:47

In this lecture we will be talking about the $group stage, which groups similar documents together, and then executes some operations on documents in every group separately. We will discuss what accumulators are. We will see in action these accumulators:

  • $sum
  • $avg
  • $min
  • $max
  • $first
  • $last
  • $push
  • $addToSet

$sample Preview 02:03

In this lecture we will be talking about the $sample stage, which randomly selects a specified number of documents.

$sort, $limit and $skip Preview 12:15

In this lecture we will be talking about three stages:

  • $sort
  • $limit
  • $skip

We will discuss the restrictions for the $sort stage and how to deal with them.

$geoNear Preview 09:39

In this video we will be talking about about the $geoNear stage, which provides geospatial support for the aggregation framework. We will write a lot of queries using real coordinates for many capitals.

$unwind Preview 08:54

In this lecture we will be talking about the $unwind stage, which is used to transform a field that contains an array, to a single value field. 

$out Preview 12:41

In this video we will be talking about exporting the result of the executed aggregation query to a collection, using the $out operator. We will discuss all the situations when exporting is not possible and how to handle such situations.

$lookup Preview 10:11

In this video we will be talking about the $lookup stage, which is used to make joins!!! This makes our life much easier and it is a big step forward for MongoDB.

$indexStats Preview 03:18

In this video we will be talking about the $indexStats stage, which is used to retrieve statistics about indexes.

Single action aggregation operations Preview 11:52

There are three methods, that are designed to perform common aggregation operations on a collection:

  • count()
  • group()
  • distinct()
We will discuss all of them in this video.

Expressions Preview 29:49

We used some expressions in the previous lectures but there are many more. In this video we will be using a lot of them.

Homework: tasks Preview 00:07

Homework: solutions Preview 00:06

Quiz

Introduction Preview 01:17

This video contains a quick introduction to schema design. 

Document embedding Preview 05:30

In this video we will be talking about embedding documents. We will discuss advantages and disadvantages of this approach. We will be talking when we should use embedding.

Linking documents Preview 10:02

In this video we will be talking about linking documents. We will discuss advantages and disadvantages of this approach. We will be talking when we should use embedding.

One-to-one Preview 11:46

In this video we will be talking about one-to-one replationships. We will discuss when we should use embedding and when linking.

One-to-many Preview 05:07

In this video we will be talking about one-to-many replationships. We will discuss when we should use embedding and when linking.

Many-to-many Preview 05:59

In this video we will be talking about many-to-many replationships. We will discuss when we should use embedding and when linking.

Designing sample relationships Preview 11:57

In this video we will be designing a relationship quite common for every internet shop: order-item. We will also briefly discuss customer-order relationship.

Two phase commit: success Preview 24:16

MongoDB does not support complex transactions. This means we cannot modify different documents atomically. In such a case we must use two phase commit. In this video we will be learning how to implement this strategy. This part one, when everything goes fine.

Two phase commit: rollback Preview 15:17

This video is the continuation of the previous lecture. In this video we will be talking about how to rollback a complex transaction when something goes wrong.

DBRefs Preview 11:13

In this video we will be learning about DB refs. We will learn what are DB refs, how to use them, and finally whether we should use them or not.

Quiz

Introduction Preview 01:16

In this video we will learn what a replica set is and what we use replica sets for.

Setting up a replica set Preview 10:13

In this video we will be settin up a replica set. At the end of this lecture we will have a working replica set, which will be used in all of the lectures in this section.

Primary and secondaries (elections) Preview 02:14

In this lecture we will introduce a concept of PRIMARY and SECONDARY servers. We will discuss who can vote and who can be elected.

Writing and reading data Preview 03:56

In this video we will be talking about writing and reading data to/from a replica set. This will demonstrate the difference between a primary server and secondary servers.

Replication Preview 09:12

This video explains how the replication process works. We will learn how data is transferred from a primary server to secondary servers. We will understand what the eventually consistent term means.

Types of members Preview 05:36

A replica set consists of many members. Every member can have a different purpose. We will discuss different types of members:

  • regular server
  • backup server
  • ARBITER

We will also learn how to check the current replica set configuration using the rs.conf() method.

Current state of a replica set Preview 03:03

It is important to understand how to check the current status of a replica set. In this lecture we will learn how to use the rs.status() method and how to read the result.

Automatic failover Preview 03:29

Automatic failover is one of the reasons to use replica sets. In this video we will learn what it is and we will observe in action how it works.

Your application: working with a replica set Preview 04:35

This course is not about building applications, but about MongoDB. This lecture is a kind of extra lecture, to help you work with replica sets.

In this lecture we will discuss two topics:

  • connecting to a replica set
  • read preference

Designing a replica set Preview 03:05

In this lecture we will be talking mainly about things we should avoid when configuring a replica set

Quiz

Introduction Preview 03:19

In this video we will be learning what sharding is. We will discuss the typical topology of a sharded cluster. We will learn what are the main benefits of using sharding.

Setting up a sharded cluster Preview 19:58

In this video we will be setting up a sharded cluster. We will go through all the steps required to set up a sharded cluster. At the end of this lecture we will have a working sharded cluster.

Homework Preview 01:52

In this video you will find a description of the homework for you. Don't worry, you should be able to complete it. The solution to this homework can be found in the next lecture.

Homework: solution Preview 00:04

Primary shard Preview 08:12

In this video we will be learning what a primary shard is. We will also learn what the sh.status() method is used for and how to read the results returned by this method.

Sharding collections Preview 09:53

In this video we will be learning how to shard our collections. This means that we will learn how to distribute our collection across all shards. We will be using these methods:

  • sh.enableSharding()
  • sh.shardCollection()

Sorted shard key Preview 16:57

In this video we will be talking about sorted shard keys. We will discuss the following requirements for such keys:

  • it cannot be monotinically increasing
  • it must have a high cardinality

We will learn what this means and what are the consequences of breaking these requirements.

We will also discuss some restrictions.

Hashed shard key Preview 07:05

In this video we will be talking about hashed shard keys. We will discuss what the difference from sorted shard keys is. We will learn what are the advantages and disadvantages compared to sorted shard keys.

Shard keys and queries Preview 06:16

In this video we will learn the consequences of choosing a sorted or hashed key for our queries.

Quiz

Introduction Preview 02:27

In this video we will be talking about GridFS. We will learn what it is used for.

Component and connection Preview 01:51

In this video we will be talking about connection options for mongofiles.

Data representation Preview 07:19

In this lecture we will discuss how mongoDB stores GridFS data. Thanks to this we will be able to understand whether GridFS is a silver bullet for storing files or not. 

Commands Preview 12:33

In this video we will be talking about all the commands we can use. We will use them all and check how they work. These commands are:

  • list
  • search
  • put
  • get
  • get_id
  • delete
  • delete_id

Quiz

Storage engines Preview 05:06

In this video we will be talking about storage engines. Firstly we will learn what storage engines are, and then we will compare WiredTiger and MMAPv1 storage engines.

Write concern Preview 08:14

For many methods that modify data we can set write concern. Time to learn what write concern is.

We will also learn what is journaling as this is important to undertand how write concern works.

Authentication Preview 04:12

Almost always a database is protected from unauthorized access. In this video we will be learning how to authenticate ourselves. We will discuss two possible ways to do this, so using options or the db.auth() method.

The end Preview 00:29

This is my goodbye to You. I'm not a very expressive person as You will see, but I really thank You and wish You all the best! Take care!!!