Interview Questions

AJAX Interview Questions Android Interview Questions Angular 2 Interview Questions AngularJs Interview Questions Apache Presto Interview Questions Apache Tapestry Interview Questions Arduino Interview Questions ASP.NET MVC Interview Questions Aurelia Interview Questions AWS Interview Questions Blockchain Interview Questions Bootstrap Interview Questions C Interview Questions C Programming Coding Interview Questions C# Interview Questions C++ Interview Questions Cakephp Interview Questions Cassandra Interview Questions CherryPy Interview Questions Clojure Interview Questions Cobol Interview Questions CodeIgniter interview Questions CoffeeScript Interview Questions Cordova Interview Questions CouchDB interview questions CSS Buttons Interview Questions CSS Interview Questions D Programming Language Interview Questions Dart Programming Language Interview Questions Data structure & Algorithm Interview Questions DB2 Interview Questions DBMS Interview Questions Django Interview Questions Docker Interview Questions DOJO Interview Questions Drupal Interview Questions Electron Interview Questions Elixir Interview Questions Erlang Interview Questions ES6 Interview Questions and Answers Euphoria Interview Questions ExpressJS Interview Questions Ext Js Interview Questions F# Interview Questions Firebase Interview Questions Flask Interview Questions Flex Interview Questions Fortran Interview Questions Foundation Interview Questions Framework7 Interview Questions FuelPHP Framework Interview Questions Go Programming Language Interview Questions Google Maps Interview Questions Groovy interview Questions GWT Interview Questions Hadoop Interview Questions Haskell Interview Questions Highcharts Interview Questions HTML Interview Questions HTTP Interview Questions Ionic Interview Questions iOS Interview Questions IoT Interview Questions Java BeanUtils Interview Questions Java Collections Interview Questions Java Interview Questions Java JDBC Interview Questions Java Multithreading Interview Questions Java OOPS Interview Questions Java Programming Coding Interview Questions Java Swing Interview Questions JavaFX Interview Questions JavaScript Interview Questions JCL (Job Control Language) Interview Questions Joomla Interview Questions jQuery Interview Questions js Interview Questions JSF Interview Questions JSP Interview Questions KnockoutJS Interview Questions Koa Interview Questions Laravel Interview Questions Less Interview Questions LISP Interview Questions Magento Interview Questions MariaDB Interview Questions Material Design Lite Interview Questions Materialize CSS Framework Interview Questions MathML Interview Questions MATLAB Interview Questions Meteor Interview Questions MongoDB interview Questions Moo Tools Interview Questions MySQL Interview Questions NodeJS Interview Questions OpenStack Interview Questions Oracle DBA Interview Questions Pascal Interview Questions Perl interview questions Phalcon Framework Interview Questions PhantomJS Interview Questions PhoneGap Interview Questions Php Interview Questions PL/SQL Interview Questions PostgreSQL Interview Questions PouchDB Interview Questions Prototype Interview Questions Pure CSS Interview Questions Python Interview Questions R programming Language Interview Questions React Native Interview Questions ReactJS Interview Questions RequireJs Interview Questions RESTful Web Services Interview Questions RPA Interview Questions Ruby Interview Questions Ruby on Rails Interview Questions SAS Interview Questions SASS Interview Questions Scala Interview Questions Sencha Touch Interview Questions SEO Interview Questions Servlet Interview Questions SQL Interview Questions SQL Server Interview Questions SQLite Interview Questions Struts Interview Questions SVG Interview Questions Swift Interview Questions Symfony PHP Framework Interview Questions T-SQL(Transact-SQL) Interview Questions TurboGears Framework Interview Questions TypeScript Interview Questions UiPath Interview Questions VB Script Interview Questions VBA Interview Questions WCF Interview Questions Web icon Interview Questions Web Service Interview Questions Web2py Framework Interview Questions WebGL Interview Questions Website Development Interview Questions WordPress Interview Questions Xamarin Interview Questions XHTML Interview Questions XML Interview Questions XSL Interview Questions Yii PHP Framework Interview Questions Zend Framework Interview Questions

Top 25 MongoDB interview Questions for 2020

1) Give some history about MongoDB.

MongoDB came into existence when data increased exponentially on the internet. Thus, maintainence of database became very difficult in structured DB. MongoDB is a NoSQL (Not Only SQL) database which can handle and sort all type of unstructured and complicated data.

2) Write some advantages of MongoDB over other database.

MongoDB is a document type database which is a type of NoSQL database which provides:
  • High performance
  • High availability
  • Easy Scalability
  • Rich Query Language

3) What is "Namespace" in MongoDB?

MongoDB uses BSON (Binary interchange & Structure Object Notation) which stores object in collection. Thus, Namespace is the concatenation of Collection name and Database name.

4) Explain the use of Locks to maintain consistency.

MongoDB uses reader-writer Locks which allows multiple users to access and apply READ operation on database or collection. It only allows single WRITE operation for private access which helps in maintaining consistency.

5) Define "Sharding" in MongoDB.

Sharding is a process in which data is stored across multiple machines. It creates a horizontal partition in database where each partition is referred as database shard.

6) What is a Replica Set?

It is a group of Mongo instances that maintains same data set. Replica set provides redundancy and consists of two nodes "Primary Node" and "Secondary Node" within which all data replicates.

7) Explain the process to move old files into moveChunk directory?

It is acheive at a time of shard balancing when the functions are done then old files are converted to backup files and moved to moveChunk directory.

8) Does MongoDB support primary-key, foreign key relationship? If not, how can we achieve it?

By default, MongoDB doesnot support primary-key, foreign key relationship but we can achieve it by embedding one document into other document.

9) Write the syntax for Create and Drop Collection?

Create Collection syntax:
db.createCollection(name,options)
Delete Collection syntax:
db.collection.drop()

10) How to use schema in MongoDB database?

MongoDB database has dynamic schema where we don't have to define the structure to create collections.

11) What is object composed of?

Object is composed of
  • Timestamp
  • Client machine ID
  • Client process ID
  • 3 byte incremented counter

12) Explain Indexes in MongoDB.

It is a special structure in MongoDB which allows easy traversing for small set of data. It consists of order by value for specific field. Index stores the value of specific set of fields.

13) Write syntax for Index in MongoDB?

Syntax:
db.COLLECTION_NAME.ensureIndex ( {Col_name:VALUE} )

14) Explain GridFS in MongoDB.

GridFS is used to retrieve large data files such as image, video, audio files. Default method is fs.files, fs.chunks for storage of files metadata and chunks.

15) Write alternate database of MongoDB?

  • CouchDB
  • Cassandra
  • Hbase
  • Redis
  • Riak

16) Why is MongoDB not chosen for a 32-bit system?

Mongo DB is not considered as a 32-bit system because for running the 32-bit MongoDB, with the server, information and indexes require 2 GB.

17) How does Journaling work in MongoDB?

Journaling is used to safe backups in mongodb.Write operations are saved in the memory while journaling is going on. The on-disk journal files are really dependable for the reason that the journal writes are habitual. Inside dbPath, a journal subdirectory is designed by MongoDB.

18) What is CRUD?

Mongodb provides CRUD operations that are create, Read, Update, Delete.

19) What is Aggregation in MongoDB?

Aggregations are operations that process data records and return computed results.

20) Which command is used for inserting a document?

database.collection.insert (document) is used for inserting a document.

21) What is the use of profiler?

Profiler is used to show the performance characteristics of every operation against the database.

22) What is embedded documents?

Embedded documents capture relationships between data by storing related data in a single document structure.

23) What is replica set oplog?

The oplog records all operations that modify the data in the replica set.

24) What is vertical scaling?

Vertical scaling adds more CPU and storage resources to increase capacity.

25) What is horizontal scaling?

Horizontal scaling divides the data set and distributes the data over multiple servers, or shards.



ADVERTISEMENT
ADVERTISEMENT