Quick Enquiry

Please type below

captcha

c
06 Jun 2018

Overview of Mongo DB | Creating User in Mongo DB & Assigning Roles

blog-image-3515

MongoDB is a move-platform, file-oriented database that gives high performance, excessive availability, and smooth scalability. MongoDB works on the idea of collection and report.

Database:

The physical field for collections is Database. Each database receives its very own set of files at the file device. A single MongoDB server commonly has more than one database.

Collection:

A collection is a group of MongoDB documents. It is the equivalent of an RDBMS table. A collection exists inside a single database. Collections do not enforce a schema. Documents inside a collection may have exceptional fields. Typically, all files in a group are of similar or related purpose.

Document:

A set of key-value pairs is a document. Documents have a dynamic schema. Dynamic schema approach that documents within the same series do not want to have the identical set of fields or structure and not unusual fields in a collection’s documents can also preserve specific varieties of facts.

Advantages of MongoDB over RDBMS:-

  • It is a Schema-less
  • Structure of a single object is clear.
  • No complex joins.
  • Deep query-ability. MongoDB supports dynamic queries on documents using a document-based query language that’s nearly as powerful as SQL.
  • MongoDB is easy to scale.

 

Mongo DB

Creating User in MongoDB & assigning Roles:-

Creating a consumer administrator in MongoDB is carried out with the aid of the use of the createUser technique.

Code Explanation:

  1. The first step is to specify the “username” and “password” which needs to be created.
  2. The second step is to assign a position to the person. Since it wishes to be a database administrator in which case we’ve got assigned to the “userAdminAnyDatabase” position. This function allows the person to have administrative privileges to all databases in MongoDB.
  3. The DB parameter specifies the admin database which is a unique Metadatabase inside MongoDB which holds the facts for this user.

Mongo DB Training

Managing users:

First, understand the roles which you need to define. There is a whole listing of function to be had in MongoDB. For example, there is the “read role” which allows read-only access to databases and then there may be the “read-write” role which presents examine and write access to the database, this means that the person can trouble the insert, delete and replace commands on collections in that database.

 

Please follow and like us:

No comment posted.

Facebook
Facebook
LinkedIn
YouTube
YouTube
Google+
Google+
https://www.iqonlinetraining.com/overview-of-mongo-db/