What Is MongoDB?

What Is MongoDB?
26 Nov 2020

In the simplest definition, MongoDB is an open source NoSQL (Not only SQL) database application. MongoDB, developed by MongoDB Inc. using C++ programming language in 2009, is a document-based and scalable application. Due to its fast and open source code, MongoDB has gained popularity all over the world, which is more preferred in structures where traditional relational databases cannot catch up and remain cumbersome. As GTech, we have answered some questions about the MongoDB database application and usage areas in our article.

What are the Features of MongoDB?

  • It has a scalable structure.

  • Supports range queries, field searches and regular definition searches.
  • It can index any field in the document in Binary BsON format.
  • It can create multiple copies of the original data and thus prevent data loss.
  • It allows data to be processed collectively as well as collecting data.
  • Driver support is available for most of the current programming languages

Companies Using MongoDB

As we mentioned earlier, MongoDB is a popular database application around the world. Today, MongoDB, which is used by many businesses, is also preferred by some companies with worldwide recognition.

How to Use MongoDB?

MongoDB contains many commands that can be used for different purposes. In this article, we will show you how to run a few of the most used commands with MongoDB.

• Mongo: It is the command required to run the MongoDB database application. After opening the MongoDB command screen, type the “mongo” command to run MongoDB.

Show databases: The “show databases” command is used to list the databases in the system. When this command is entered, the databases in the system and the list of the dimensions of these databases are displayed.

Use: This command is used to create a new database or to open an existing database. For example; If the command “use NewDataBase” is entered and there is no database named NewDataBase in the system, this database is created. After the database is created, the message “switched to db NewDataBase” appears on the screen. If we use the “use” command with an existing database name, it will switch to that database.

• dropDatabase(): This command is used to delete an existing database. The usage method is “use DatabaseName” and after selecting the database, “db.dropDatabase()” command is given and the relevant database is deleted from the system.

• createCollection (“newtable”): When this command is used, a new table is created in the database. As in the previous operations, first run the command “use DatabaseName” and then execute the db.createCollection(“tablename”) command to create a new table.

• Show collections: This command is used to list the tables in the database.

tablename.drop(): We use this command when we want to delete any of the tables in the database.

tablename.insert({}): Using this command, we can add data to a table in the database. For example; When we enter a command db.tabloname.insert({“category”: “shoes”, “color”: “black”, “number”:”42″}), we add black shoes with size 42 to the table.

For more detailed information about GTech’s products and services, please contact us.