Posts tagged "Database"

5 posts

MongoDB Index Types

Indexes in MongoDB are like the secret sauce that makes your database queries faster and more efficient. Imagine trying to find a specific book in a library without an index – you’d be wandering the aisles for days! Similarly, indexes in MongoDB help you quickly locate the data you need without sifting through every document. But beware, with great power comes great responsibility – indexes can also slow down write operations and consume extra storage.

MongoDB backup and restore

Backup and restore are essential routine jobs. If you are working with MongoDB, then you must know how to take backups as well as how to restore them. MongoDB comes with excellent command-line tools for taking backups and restoring backups, i.e., mongodump and mongorestore. This post shows MongoDB’s backup/restore methods; you can refer to MongoDB documentation for backup and restore strategies for more insight. But what I am going to show you are the most common and simple ways to backup and restore MongoDB.

CRUD operations in MongoDB

The acronym CRUD stands for Create, Read, Update, and Delete. In this section, we will learn basic CRUD operations. CRUD operations can be extremely complex sometimes, but we will not go into the complicated stuff for two reasons. First, it is not under the scope of this post. Second, we will be doing a lot of CRUD operations in the following posts. Before we start learning CRUD, I must tell you that we will be using the mongo shell for CRUD in the following sections.

Indexes in MongoDB

MongoDB provides different kinds of indexes. Indexes are vital when the dataset is big. You just cannot keep scanning the whole collection on disk again and again for every query. So, indexing becomes extremely important when you have a massive amount of data stored in the collections. But when you have a huge dataset, then chances are there that one type of index will not fit for all as the nature of data differs.

MongoDB GridFS using Python

Data is collected and stored in different forms depending on the nature of data. It can be in the form of text, images, videos, audio files, and files in other formats. MongoDB can be used for storing all kinds of data, but so far, we have used it for storing plain text information in MongoDB documents. As you know by now, that MongoDB document has a size limit of 16MB.