This MongoDB command is beneficial as it shows your status about low running memory, some performance issues, etc. These counters include inserts, updates, queries, deletes, and cursors. It tracks and returns the counter of database operations. To check the status of all your running processes/instances, a mongostat command is helpful. To restore the backup, a mongorestore command is used. The server’s entire data will be dumped into a dump directory(/bin/dump/). To create the backup, mongodump command is used. Now Start the MongoDB server by specifying - replSet option. Let’s see standalone MongoDB instance gets converted into a replica set. All write operations remains with the primary node. In replica, one node is the primary node and rest others are the secondary node. Redundancy hence faults tolerant/disaster recovery.A replica set is a group of MongoDB processes that have the same dataset. Replication in MongoDB is achieved using a replication set. This can group values from multiple documents together. This MongoDB command helps in processing the data, which returns the calculated result. Indexing is the concept that helps MongoDB to scan documents inefficient wayĪdvanced Commands of MongoDB 1. 1 is for ascending whereas -1 is for descending.ģ. The argument is the number of the document that needs to be displayed. The argument of this function accepts only number type. Querying collection is done by find() method.Īs find() method will show the findings in a non-structured way, to get the results in a structured pretty() method is used. If the collection doesn’t exist, then MongoDB command will create the database collection and then it will get inserted. Insert() or save() method is used to insert data into any database collection. Though “Options” parameter is optional, it’s good to provide it. Here, the name is the name of the collection & options is a document used to specify the configuration of the collection. To create collection, the MongoDB command used is: db.createCollection(name, options) If the database is not specified, then it will delete the default database that is “test”. Suppose you inserted a document without specifying the database, it will automatically be stored in a “test” database. If this name database doesn’t exist, it will get created, and else it will return the existed one.īy default, MongoDB command comes with database name “test”. In MongoDB use, DATABASE_NAME is used to create a database. Hence more efficient.īasic of MongoDB Commands 1. The result of which automatic load balancing happens. MongoDB command comes with the auto-sharding feature, in which process distributes data across multiple physical partitions known as shards.The result of which it’s a great advantage in case of hardware failure. This database can run over multiple servers hence data is duplicated over multiple servers.To prevent database downtime, this replica feature is proved to be an essential feature. MongoDB command uses a master-slave replication concept.No downtime, if the application is scaled.This goes with the case, where the app needs to be built from scratch or the case of updating a single record. It can easily control the data which is placed globally, ensuring fast performance and compliance.Instead of using the relational database concept of storing data in the form of the table, MongoDB architecture is made up of collections and documents. It is one of the NoSQL databases, highly used for big data applications and other complex job processing for the data that doesn’t go well with the relational database. MongoDB is a cross-platform, document-oriented, open-source database management system that provides, high availability, high performance, and easy scalability.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |