MongoDB Interview Question Answer

Document Based Database :- Starting with paper based storage from 90's to relational database management system until 2000's database plays a pivotal role in maintaining the business.Document based databases are the DB's of this decade. Data has become Big DATA and hence the approach to store the information needs to be changed from relational to document as the data model has evolved from record to document level To put it in simple terms document based databases are NoSQL databases that support big data.Some popular and widely used document based databases include : 1) Mongodb - This is the most popular NoSQL database supporting enterprise wide bigdata. With recent acquisition of Tigerwire MongoDB has been constantly improving the performance of database storage engine. MongoDB adapts JSON format to store data. The way in which information is stored typically is based on javascript base 2) Cassandra 3) Redis 4) Vertica from HP 5) CouchDB mongodb --install has to be used with --logpath : Upon downoading mongodb binary bundle, we tried installing the mongodb by running the binmongod.exe as follows mongod.exe –install Here is the error that I got upon running the command --install has to be used with --logpath To fix the error mention details on logpath the location and name of file into which installation steps and errors if any are logged. The default format of logfile is .txt mongod.exe –install –logpath .mongod_install.log The above command will log the installation steps, their status including (success/failure) in mongod_install.log file MongoDB Management Service MMS From MongoDB :- MongoDB the NoSQL database has been evolving on a continuous basis. One of the latest and finest services from MongoDB team is the MMS the MongoDB Management Service What is MMS? As per MongoDB, MMS is a cloud based service. It is used for monitoring and backing up mongoDB deployments on a real time basis To avail benefit of MMS, we need to run Agents in MongoDB deployments. These agents take care of interacting with MMS. If you are familiar with Oracle database it is similar to agents the small applications that we run in Oracle deploymens that communicate with Oracle Enterprise Cloud service What is purpose (or) use of MMS in real-time? MMS offers following benefits to MongoDB production deployments 1) Backup systems running mission critical data. This includes backup monitoring as well 2) Performance monitoring of system 3) Custom alerts can be configured alongside performance monitoring 4) The information obtained helps us gain valuable insights while debugging issues 5) Backup of deployment happens in cloud Where do I access MMS? It is MongoDB offered service. This can be accessed and setup at : https://mms.mongodb.com/ MongoDB GUI Tools from third-party :- GUI tools dont come as an integral part of MongoDB. Most of administrative tasks are accomplished using shell manual:mongo However, third party vendors have come up with some GUI that help with mongodb administration and data management 1) Edda 2) UMONGO aka JMONGO Browser 3) MongoExplorer 4) Mongovision 5) MongoVUE 6) Opricot 7) mViewer 8) PHPMoAdmin 9) RockMongo 10) Meclipse 11) GEnghis 12) Humongous 13) Monad management for MongoDB MongoDB Interesting features a Quick Overview :- MongoDB is the most popular open-source nosql database that has entrprise support from 10gen. It is the most popular document database. This DB has its base code written in C++ (note that popular rdbms like oracle ahve their coding done in c/c++) and offers plethora of features 1) Most interesting feature of document based database is that it is scalable (i.e) it has the feature to scale out automatically depending on load 2) It offers document based storage options (i.e) information is stored as documents key:value pair rather than rows as in case of RDBMS.These are JSON-style documents 3) Indexing support on any of the attributes (columns) 4) High availability possible using replication and mirroring over network architectures including LAN & WAN 5) Horizontal scaling aka Auto sharding without conpromising functionality 6) Querying od document database 7) In-place updates that facilitates atomic modifiers for contention free performance 8) Aggregation and data procesing possible using MAp/Reduce 9) Stores files of different sizes using GridFS 10) Enterprise implementation and support availability NoSQL Databases Quick Overview :- NoSQL databases the databases of 21st century have been gaining popularity to support the growing big data. There are wide variety of NoSQL databases that are primarily designed to support unstructured data. Among them some are gaining stability , popularity, support. Lets take a quick look at the most popular nosql database mongodb MongoDB - Formerly 10gen is the most popular NoSQL database not only because of its document oriented architecture but also due to its robustness, stability, scalability, concrete team, customer support, 231 million venture capital fund etc Lets take a quick look at some interesting features of mongoDB 1) Offers business continuity using replication utilizing replica sets 2) Sharding offers horizontal scalability 3) Utilizes journaling to recover automatically from failure of database 4) Interesting reporting tools like mongostat,mongotop. This helps in monitoring of mongodb instances. MMS the mongodb monitoring service is the GUI used to monitor mongodb instances 5) Backup using mongodump 6) Logical backup by exporting and importing data using mongoexport, mongoimport tool C100DBA MongoDB Certified DBA Associate Exam is for database aspirants who prefer to start their pilot effort in NoSQL and big data space. This is the fastest growing arena and is gaining popularity at lighting pace. MongoDB the document based NoSQL database is gaining popularity among big data users and the certification credential demonstrates the abilities of an individual to perform job duties as a DBA. As per MongoDB, this exam is for DBA's who have knowledge and understand the mongoDB concepts.This exam course topics are geared towards administrators and can be useful to someone who is in operations, support, database administration as well as quality assurance engineers, business analysts who prefer to start learning NoSQL database Give some information on the exam:- As of date, this exam is based on MongoDB 3.0 the latest version of MongoDB This exam is delivered online and can be taken in proctor centre So, what exactly is needed to attempt and clear the exam? C100DBA MongoDB Certified DBA Associate Exam is still in associate level. As per mongodb the official exam provide to attempt and clear the exam the candidates must possess the following skills 1) Fundamental database and system programming concepts – MongoDB is a database. Though branded as NoSQL most of the concepts are derived out of reationalmodel. This knowledge helps 2) Javascript – MongoDB the document-oriented database is based on javascript and this knowledge comes handy 3) MongoDB database concepts – These are the topics that are confined to MongoDB to name a few like sharing, indexing, aggregation, replication, server administration etc What mongodb topics are covered in exam? This is at MongoDB associate level and will give a ticket to enter the ocean of NoSQL databases. Some interesting topics include Basics of NoSQL databases : performance benefits,JSON, BSON, fault tolerance, disaster recovery, horizontal scaling, and the Mongo shell Create, Read, Update, and Delete (CRUD) operations Indexing: single key, compound, multi-key, mechanics, and performance Aggregation: pipeline, operators, memory usage, sort, skip, and limit Replication: configuration, oplog concepts, write concern, elections, failover, and deployment to multiple data centers Sharding: components, when to shard, balancing, shard keys, and hashed shard keys Application Administration: data files, journaling, authentication, and authorization Server Administration: performance analysis, diagnostics and debugging, maintenance, backup, and recovery What is a mongoDB enterprise? This is the commercial edition of mongodb database It offers finely-tuned software packages, support, certificaitons for production business Security and authentication options to run safe business MMS On-prem as it is popularly called is the mongodb management service on-prem. It is the option that makes working with MongoDB enterprise easy, simple and the instances can be maanged from datacentre. MMS On-prem provides the following options: 1) Backup - Backup option is available with mongodb enterprise. Advanced backup options including poin-in-time recovery for replica sets, synchronization of snapshots in sharded cluster is possible using MMS on-prem 2) Monitoring of mongodb instances - Any database isntance needs constant monitoring to look for security alerts and thresholds that cause potential problems. With MMS it is now possible to monitor over 100 performance metrics, tune the production deployment, set custom alerts, trigger alerts, discover performance issues etc To put it simple MMS on-prem is for mongodb enterprise platform MongoDB filesystem snapshots : MongoDB ensures availability of data adopting backup/ restore policies. MongoDB stores information in data files and these needs to be backed up from time to time in form of mongodb filesystem snapshots.File system based tools that control creation of snapshots like lvmcreate (or) storage based backup tools can be used to perform block-by-block backup of mongoDB files. In an environment with journaling in place, mongoDB files can be easily backedup on the fly. Following file-system based strategies make it pretty simple 1) Create snapshot based on system utilities like lvmcreate 2) Create snapshot based on storage backup utilities In either of these cases follow these simple steps 1) Create a snapshot of mongoDB files - datafiles, journal files - the /data/db directory holding the files 2) Choose to compress them using zip, gzip,bzip etc 3) Move the backups onto tapes and archive them 4) Move tapes off-site - based on SLA From time-to-time perform disaster recovery testing as follows: 1) Restore from tapes 2) Unarchive/unzip the files 3) Mount onto a new mount point 4) Make sure they are consistent after starting mongoDB instance In case of environments without journaling perform the following: 1) Flush the writes onto disk and lock write operations (insert, update, delete) db.fsynclock(); 2) Perform snapshot 3) Unlock the write locks db.fsyncunlock(); SQL database to NoSQL database Transformation : NoSQL is the talk of tech town these days. Database professionals be it developers, DBA's , Data analysts have started thinking about learning some NoSQL. To start with it becomes necessary to choose the best NoSQL version as there are more than 30 versions already out in market. Lets start with most stable version of NoSQL databases that is gaining wide popularity the MongoDB. To start with lets take a look at some of the SQL concepts and its equivalent in MongoDB
Generic SQL MongoDB Operator Equivalent
where $match
having $match
group by $group
select $project
order by $sort
limit $limit
sum function $sum
count function $sum
join $unwind