C100dba mongodb exam sample questions

C100dba is the mongodb dba certification track. To prepare for this c100dba examination start learning with the following mongodb certification exam questions
1. What is the use of mongodump and mongorestore tools?
a. replicate mongodb deployments
b. performance tune mongodb deployment
c. backup mongodb deployment
d. audit mongodb deployment
Answer : c
Explanation: These tools are used to perform back of simple mongodb deployments.
2. In what format does mongodump creates backup files?
a. XML
b. JSON
c. BSON
d. SOAP
Answer : c
Explanation: Mongodump is a simple backup utility that does read the information from mongodb database. Backup files are created in the form of BSON files
3. Which mongodb tool is used to report details on number of database operations in MongoDB?
a. mongodump
b. mongostat
c. mongorestore
d. mongotop
Answer : b
Explanation : Mongodb comes with set of reporting tools. Among these mongostat captures count of database operations like insert, update, delete, read counts. This gives details on load distribution profiles in server
4. Which command is used to determine storage capacity of specific database?
a. mongotop
b. mongostat
c. dbstats
d. collstats
Answer : c
Explanation : dbstats is a mongodb reporting tool used to monitor the state and storage usage of a particular database
5. Mongodb does provide high availability via which option?
a) Sharding
b) Replication
c) Indexing
d) Journaling
Answer : b
Explanation: In mogodb high availability is possible using replica sets
6. What is the on-premise solution having functionality equivalent to cloud manager?
a. Journaling
b. Ops Manager
c. Service Manager
d. Replica Manager
Answer : b
Explanation: Ops manager has functionality similar to cloud manager. As opposed to mongodb cloud manager backup this is an on-premise solution that subscribers can install
7. Which mongodb tools allow us to work with our data in a human readable format?
a) mongodump
b. mongostat
c. mongoexport
d. mongoimport
Answer: c,d
Explanation : mongoexport and mongoimport tools help in working with data in extended JSON or CSV format
8. Which of the following node is used during election in a replication cluster?
a. hidden
b. arbiter
c. primary
d. secondary
Answer: b
Explanation: Lets first understand what an arbiter is. An arbiter refers to mongodb instances that are part of replica set but dont hold data. As they dont hold data arbiter hardware requirement is minimum. They do not need separate serer, instead they can be deployed alongside application servers, monitoring host etc. In a replica set there should always be even number of members. Arbiters are preferred nodes to be elected during failure fo replica set
8. Which node in a replica set does accept write operation?
a. primary
b. arbiter
c. secondary
d. hidden
Answer : a
Explanation : In a replica set primary is the only member that can accept write opertions
9. What is the need of election in replica set?
a. secondary becomes unavailable
b. arbiter is unavailable
c. primary is unavailable
d. hidden node
Explanation : Election in a replica set happens when the primary becomes unavailable. Elections are needed for independent operation of replica set. In a replica set primary is the only member that can accept write operations. If the primary becomes unavailable replica set becomes read only
10. You are in a sharded cluster. What will you do prior to initiating backup in sharded cluster?
a. db.stopserver()
b. sh.stopserver()
c. db.stopBalancer()
d. sh.stopBalancer()
Answer : d
Explanation : sh.stopBalancer() is used with the arguments timeout, interval. Typical usage is sh.stopBalancer(timeout,interval) used to disable balancer in a sharded cluster. Timeout defaults to 60000 milliseconds. Interval is in milliseconds
11. You have a replicated cluster with 1 primary, 3 secondary, 1 arbiter. One of the secondary is hidden. What is the replication factor of this replicated cluster?
a. 6
b. 7
c. 4
d. 3
Answer : c
12. In mongodb how do you update a document partially?
a. $project
b. $update
c. $set
d. $modify
Answer : c
Explanation : The $set operator replaces the value of a field with the specified value

Get MongoDB Articles for FREE:

Delivered by FeedBurner

slamdata 3.0 makes live mongodb data display without ETL

Earlier we discussed about availability of slamdata a non-ETL solution to display live data from mongodb. It is interesting to know that slamdata has undergone rapid development over the pat two years and is currently at stable version 3.0
Slamdata makes it possible to display live data from mongodb database without using ETL tool. Hassle of extraction, transformation.loading, ETL mapping is being rid of using slamdata
Here are some interesting features of slamdata 3.0 that makes it a better choice to access live data from mongodb

1) Powerful API’s for developers – Utilizing the API’s charts can be easily embedded into mongodb applications. I remember working on reporting tool with mysql backend, perl libraries to chart the data in front-end. Now, this is a piece of cake utilizing slamdata API’s
2) Easy analytics using API’s – Analytics can be easily embedded into mongodb applications. If you are currently using panda python packages for your predictive analytics, you might be aware of power of analytics in predictive analytics of social media like twitter, facebook, linkedin etc. Try slamdata to easily implement predictive analytics in a mongodb application
3) Brand-new user interface with best look and feel – This is easy to use, brand new, extremely powerful
4) Dashboard types supported – This version supports both static and dynamic dashboard creation. Dashboard is created in user interface
5) Enhanced framework – The framework has become more extensible making ti possible to write connectors for databases beyond mongodb including Couchbase, MarkLogic, postgresql etc
6) Gallery of charts – A detailed roster of charts are supported including basic area, basic line, irregular line, area, line,stacked area, line, bar, scatter, candlestick,pie, radar, chord,fd charts ,maps,eventriver, heatmap,venn,tree,treemap,wordcloud etc
7) Powerful documentation from slamdata makes it the best analytic tool for mongodb

Get MongoDB Articles for FREE:

Delivered by FeedBurner

For storing Bigdata NoSQL databases like mongoDB come handy. These databases can easily store petabytes of data, can be scaled via sharding
Download slamdata 3.0 for free

Mongodb certification exam questions

Mongodb certification exam questions will help you prepare and crack the mongodb certification
1) How do you monitor mongodb instances?
a) mongodb utilities
b) Ops manager
c) database commands
d) All of the above
Answer : d
Explanation : Mongodb instance should be monitored starting with set of utilities that come pre-packaged as part of mongodb. These are mainly used for reporting purposes. Database commands come handy to get details on current database statistics. In addition to this mongodb cloud manager a cloud monitoring GUI, ops manage an on-premise install that has features equivalent to mongodb cloud manager help with visualization and alerts real-time from database
2) How do you start mongod and mongos instances using config file?
a) mongod -f /etc/mongod.conf; mongos -f /etc/mongos.conf
b) mongod -a /etc/mongod.conf; mongos -a /etc/mongos.conf
c) mongod -h /etc/mongod.conf; mongos -h /etc/mongos.conf
d) mongod -s /etc/mongod.conf; mongos -s /etc/mongos.conf
Answer : a
Explanation : We can start mongod and mongos instances from command-line as well as config files. To make use of config file, we specify option -f

Enter your email address:

Delivered by FeedBurner

Mongodb production database Linux deployment Best Recommendations

MongoDB can be deployed in a variety of paltforms including 32-bit windows 7, 64-bit windows 7, Mac OS, Linux, Soalris etc. Lets take a quick look at the best recommendaitons to be followed while deploying mongoDB production instances in Linux environment
1) Always run mongoDB in 64-bit environment
2) Linux kernel version 2.6.36 or later must be used
Simple command to find kernel version in Linux are
2.1) Use the uname command
uname -r
2.2) Access /proc/version files
cat /proc/version
2.3) Using Red Hat Package Manager command with -q option
rpm -q kernel
2.4) Look at dmesg command
dmesg |grep Linux
2.5) Look at book folder
ls /boot
3) Filesystem recommendation on MongoDB – As with RDBMS like Oracle, MongoDB preallocates the database files. MongoDB supports big data and often the files are large files. Filesystems like Ext4 and XFS can be used. Also, the filesystem should support fsync() on directories
4) We need to turn off accesstime aka atime in the storage volumes [disk drives] containing database files of MongoDB. atime is the file access time that is updated whenever a file is accessed including opening of files, operations like grep, sort, cat, head, tail and so on. As such this recommendaiton is to improve the speed of disk drives in Linux environment. Edit /etc/fstab file , add noatime,nodiratime at the end and disable atime
5) Optimal virtual memory apge size of mongoDB is 4096 bytes. Transparent Huge pages need to be disabled
6) To avoid conneciton issues in a heavy environment and to prevent loss of service, user limit and file descriptor limit should be set above 20000
ulimit -u
limit -n
Above command should return 20000 and above values
7) Non-Uniform Memory Access (NUMA) needs to be disabled at BIOS as there could be a performance impact while accessing multiple memory nodes
8) In a sharded cluster environment Network Time Protocol (NTP) to synchronize time among hosts
9) Block devices store database files. Readahead settings should be optimal. Often value of 32(16KB) works fine

Get MongoDB Articles for FREE:

Delivered by FeedBurner

Control Scripts MongoDB

Control scripts are the set of scripts that get created in /etc/init.d (or) /etc/rc.d directory. They usually useful in STARTUP of different services, daemon during system startup. MongoDB mainly consists of two daemons/processes namely – mongod, mongos
mongod – This is the main MongoDB daemon that runs the MongoDB server
Mongos- This is the mongoDB shard daemon
Until mongodb 2.6.2 version we had control scripts for both mongod and mongos daemons.
Starting with 2.6.3 we have control scripts only for mongod. If needed mongos control script can be created and added to system

Get MongoDB Articles for FREE:

Delivered by FeedBurner

MongoDB Interview Question And Answer

What is mongoDB?
MongoDB is a nosql database that doesnot make use of RDBMS concept. Mongodb does make use of document database concept
What operations are permitted in mongodb?
CRUD – Create , read/select,update, delete operations are permitted as part of mongodb
Can we make use of mongodb in heavy transactional environment?
It is not recommended. Mongodb is primarily used in web based environments
What is a table called in mongoDB?
Table in mongodb terms is a collection
Why is MongoDB not used for heavy transactional environment?
MongoDB the NoSQL database that is gaining rocket popularity is a document based database. Many sectors primarily healthcare, financial, retail do make use of mongoDB. Popular mongodb case studies show that it is widely used in call centre customer feedsystems.
So, what is primary use of mongoDB?
MongoDB is document oriented and doesnt follow normalization concept of relational databases. MongoDB as such has no support for concurrency the primary criteria that permits transactional consistency in RDBMS systems
Hence mongoDB is primarily used in web based systems. However, mongoDB has CRUD the create, read,/select,update ,delete operation permission
What is row in table called in mongodb?
A row in mongodb is usually referred as document
Give details on MongoDB announces paid support on community edition :
MongoDB the most popular nosql database is gaining popularity and customer base. They are planning to go public real soon. They have recently changed their CEO who is an expert with IPO. This shows the vision of this company.
Currently MongoDB is an open-source software that can be downloaded for free. MongoDB Enterprise is catered towards enterprises
MongoDB has recently announced a bold move on supporting community edition on paid basis
For full details visit :http://www.mongodb.com/lp/contact/mongodb-rescue-2014
What is rowid oracle equivalent in mongodb?
In mongodb the oracle rowid equivalent is referred as _id
What is reason behind TypeError: Property ‘findone’ of object dbname.collection is not a function :
This error occurs while using the findone() function in mongodb. findone() function is used to return first value in a database collection
db.collection.findOne()- correct format
The reason for above error being – db.collection.findone()
Make sure mongodb is javascript oriented and is case sensitive
Give MongoDB Replication A quick Look:
In case of mongoDB the client app talks to mongodb server using drivers in client application. These drivers are aware of replica set configuration in place and are prepared to failover automatically
When primary fails, the secondary becomes new primary. In this scenario the client app drivers are smart enough to recognize the new primary and have connection routed .
Usually the failover is not instantaneous and involves some lag of 10s of seconds before the failover occurs
Writes always go to primary and there comes lag into picture. However, reads can happen from secondary as well and clientapp configured to read like reporting apps are not aware of this lag. This depends on Read Preference configuration
Is MapR MongoDB Connector certified officially?
MapR the big data solution provider owns Apachae Hadoop and has come up with a partnership with mongoDB the premiere NoSQL database. MongoDB connector is officially certified to be used with MapR. This makes the bigdata migration, data mining, user segmentation adn such business decisions easy
What is a NoSQL database? Can we use it without SQL?
NoSQL is the terminology coined to represent the new generation databases. However, we can access them only using traditional SQL concept
What SQL concepts form basics of Mongo DB?
CRUD – Create, Read, Update, Delete is the basic concepts on which this database operate just like any other database
What is needed to learn mongodb?
It is a new concept and needs no background as such. As MongoDB is based on javascript good knowledge of BSON,JSON, Javascript helps
1. Give details on iterating cursor in mongoDB?
Iterating cursor in mongoDB is accomplished using db.collection.find() command. This find() command gets a cursor of documents. By default first 20 documents in collection are returned by mongoDB. To fetch and process/print more documents, use hasNext() function
2. When does a cursor gets closed in mongoDB?
MongoDB server by default closes cursor after 10 minutes of inactivity. Cursor is closed when a client exhausts the cursor
3. How to avoid the cursor inactivity and timeout behaviour?
This default behaviour can be overridden using notimeout flag
3. What are the options available in mongo shell that tweak cursor behaviour?
Mongo shell provieds many options that tweak cursor behaviour. These are the cursor flags:
DBQuery.Option.tailable
DBQuery.Option.slaveOk
DBQuery.Option.oplogReplay
DBQuery.Option.noTimeout
DBQuery.Option.awaitData
DBQuery.Option.exhaust
DBQuery.Option.partial
4. How can we increment the _id sequence number?
Adopt one of the following two procedures :
1) Make use of counters() collection
2) Make use of user coded looping
5. What is the maximum size of mongoDB document?
MongoDB can grow upto 16MB the maximum size of a BSON document. When creating a record mongoDB allocates some extra space that can be utilized in future. This is an proactive measure to allocate additional space to growing mongoDB document. This is called record padding
6) What is the default primary key field in mongoDB?
By default every collection comes with _id column
7) What is CRUD in mongoDB?
Basic database operations – create, Read, Update, Delete
1) What command in mongodb tells us more details on mongoDB cursor?
Use the following db.runcommand() to get details on cursor
db.runcommand({cursorinfo:1})
2) What are the possible CRUD operations in mongodb?
As with any other databases mongodb offers Create, Update, Delete, Projection/retrieve/select options
3) When you spcify 0 against a field what does tht mean?
Usually when we try to access/project details on documents in collection this is used
db.collection.doc({field1:0,field2:1});
The above command will show _id,field2 in output. field1 is not displayed as part of output
4) Is it possible to hide _id in projection output?
In mongodb by default whenever we issue query to get details on documents in collection, _id is included as part of output
However, it is possible to mask it in putput as follows
db.collection.document({_id:0,fields:1.});
5) What is user interfaceto interact with mongoDB?
Mongo shell is the command line client to interact with mongoDB.
6) How does mongoDB process cursor?
MongoDB processes cursors in batch. The first batch size is 1MB. Subsequent batch sizes will be around 4MB
7) What are advanced concepts that mongoDB more scalabe?
Following two interesting concepts make mongoDB scalable and make it a cnadidate to store Big Data:
1) Sharded clusters
2) Aggregation framework
8) What are data models supported by mongoDB?
MongoDB is a popular NoSQL database. Here are the data models supported by it
1) References are supported – This is a relational concept but stillsupported by monogoDB
2) Embedded documents – This is a denormalised form in which references are avoided. At higher level this improves query performance as it avoids joins
9) What is used to import json file onto mongoDB?
Mongoimport is the command line utility from MongoDB that helps to import collections into database. Store file in json format and perform import
What is the difference between compact and repairdatabase command in mongodb?
MongoDB stores data in datafiles. While a datafile is created OS disk space is allocated to datafiles. Once the informaiton is stored, deleted, processed this creates fragmentation and unused space remains intact in datafiles. To de-fragment the datafiles one of the following commands can be used
1) Mongodb compact command – This command compacts the datafiles . but unused space remains in datafiles and is not released to OS
2) repairDatabase – This command de-fragments datafiles. In addition unused space is released to operating system
What is the necessity behind mongodb log rotation?
MongoDB has the capability to rotate the current logfile by archiving it [save it as a copy] and create a new logfile.
How is log rotaiton achieved?
Mongod (or) Mongos instance renames the current logfile by appending timestamp to current logfile.. The date is by default in ISODate format.
The old logfile is closed, new logfile is opened, all the entries are sent to the new logfile.
When does a mongodb log rotation occur?
MongoDB log rotation happens under following circumstances:
1) Whenever a mongod (or) mongos process receives a SIGUSR1 signal from the operating system
2) In response to logrotate command
Can we take advantage of operating system syslog to log the mongod logs?
Yes. Mongod makes it possible to log the information onto syslog
Give detailson gridfs in mongodb:-
MongoDB 2.6.1 the latest version of mongoDB offers GridFS support to store documents.
MongoDB does support BSON documents. What is specific need of GridFS?
BSON documents has a size limitaiton of 16MB. To store files that are larger than 16MB which is ideally case with most video files, image files etc that get uploaded onto twitter, facebook ,youtube on daily basis there comes a need to store this informaiton as document chunks in GridFS instead od a single document
What is basic architecture of GridFS?
It consists of two collections stored in fs namespace
1) fs.chunks
2) fs.files
chunks – store file informaiton
files – stores metadata on file information
What is size of chunk in GridFs?
256KB is the typical chunk size as of MongoDB 2.6.1
So, why is mongodb ideal for heavy transactional environment?
MongoDB the NoSQL database that is gaining rocket popularity is a document based database. Many sectors primarily healthcare, financial, retail do make use of mongoDB. Popular mongodb case studies show that it is widely used in call centre customer feedsystems.MongoDB is document oriented and doesnt follow normalization concept of relational databases. MongoDB as such has no support for concurrency the primary criteria that permits transactional consistency in RDBMS systems.Hence mongoDB is primarily used in web based systems. However, mongoDB has CRUD the create, read,/select,update ,delete operation permission
Give details on Use of Map reduce Framework in MongoDB:-
MongoDB the most popular NoSQL database supporting Big data offers many ways to aggregate data.
This is a programming model wherein problem is expressed as map and reduce model
1) Aggregation Framework – This is default. New in version 2.2. Helps us do aggregation easily
2) Map Reduce facility which is built-in – This is used when it is not possible using aggregation framework
3) Hadoop connector – This flavour is available as part of hadoop framework – Done using Java code
How to fix TypeError: Property ‘findone’ of object dbname.collection is not a function?
This error occurs while using the findone() function in mongodb. findone() function is used to return first value in a database collection
db.collection.findOne()- correct format
The reason for above error being – db.collection.findone()
Make sure mongodb is javascript oriented and is case sensitive
10) Give details on projection operators in mongodb:-
MongoDB has some inbuilt projection operators that are primarily used for data retrieval. Lets take a quick look at the mongoDB projection operators and their usage:
1) $ – When a query is issues on a collection, documents are retrieved. $ projects the first element in the array after the query condition is matched
2) $elemMatch – This operator projects the first element in an array. Array is returned when specified $elemmatch condition is matched. Same as LIKE in RDBMS
3) $meta – This operator is used to project documents score assigned during $text operation
4) $slice – Limits the number of elements projected from an array. Supports skip and limit the number of slices. Same as limit condition in RDBMS
10) How to separate tables from indexes at physical level in mongodb?
11) What is the memory recommendation of mongodb?
While installing and configuring mongodb databases in production it would be appropriate to follow best recommendation values. Here are the mongodb best recommendation during production deployment
Give details on mongodb index filters :-
MongoDB does create index filter for a query shape. A query shape is a combination of query, sort, projection criteria. In simple words we cna determine if we need to make use of indexes for a query. If an index filter is in place for a query it overrides hint(). Say, we provide a hint as part of a query, however some index filters do exist in place. In this scenario index filters are used. Hint is ignored.
Say, we try to run the query with hint after a server restart. Will hints be used? Yes. Reason being index filters don’t exist after a server restart
I don’t want a server restart. I do have index filters. What can I do?
Make use of PlanCacheClearfilters using db.runcommad({plancacheclearfilters:collectionname,…})
12) What are the database commands to monitor activity of mongodb?
13) What is flexibility of mongodb over rdbms?
14) How does MApR works with mongodb?
MapR the big data solution provider owns Apachae Hadoop and has come up with a partnership with mongoDB the premiere NoSQL database. MongoDB connector is officially certified to be used with MapR. This makes the bigdata migration, data mining, user segmentation and such business decisions easy

Get MongoDB Articles for FREE:

Delivered by FeedBurner

Why should oracle dba upgrade their mongodb skills

As a seasoned oracle DBA if you are in middle level DBA , Senior oracle DBA it is right time to start thinking about a NoSQL database. Note that this does not have to be a total s witch onto mongodb as is the cc case with switching from oracle DBA to SQL Server. However, if you have job experience as an Oracle DBA now, think about learning MongoDB without any delay.
The first step towards becoming MongoDB DBA is to prepare for the MongoDB DBA exam. Note that appearing for the exam, clearing te certification is totally optional. If you can afford to do it go ahead. All we need is to have hands on practice on the concepts covered in this C100DBA exam
Organizations are serious about bigdata. NoSQL databases are the right data solution to host bigdata. There are amny popular nosql databases in the market starting with cassandra, couchDB, apache HBase. However, organizations that do have oracle implementation are actively looking for candidates wit mongoDB DBA skills. If you look at a typical job profile for a new big data project the candidate is expected to have current experience in oracle database administration. However, this does not stop here. MongoDB the most popular nosql database offers enterprise nosql solution. IF you look from strategic perspective, top professionals in mongodb are being hired from oracle corporation. As such mongodb is the preferred choice as there will be great comparability in the form of data migration tools from oracle onto mongodb. Subscribe with us today to learn interesting mongodb articles for free

Get MongoDB Articles for FREE:

Delivered by FeedBurner

How and When to use indexes in MongoDB

As with any of the relational databases mongoDB does support index as part of application design. Here are some best tips and practices that can be considered or taken as a strategy while determining to create indexes
1) Look for size of an index. To see what is the current size of an index issue db.collection.totalIndexSize() command that gives details of total index size in a collection. For efficient index access they must reside in RAM. With recent mongoDB implementaiton now it is possible for the index to maintian most recent most frequently accessed information in RAM instead of all info. This conserves RAM needed to store working sets
2) For queries that are covered indexing is the most efficient way to go. A query is considered covered only if all the fields in the query are part of index. In such cases only index is used to return information and document access is totally skipped. However , this has some limitation on fields that do contain array data types. Covered indexes can’t be created in such fields
3) Frequency at which query is used in an application – Say a query does use a document on a frequent basis then that field can most likely be indexed. If the query clause involves $or operator multiple indexes are used. If not only one index is used. If there are more than one fields being used in query use compound index
5) Indexes helps with returning sorted results

Get MongoDB Articles for FREE:

Delivered by FeedBurner

SyntaxError: Unexpected token { error in mongodb

MongoDB the most popular open source database, is the NoSQL database that is most popular owing to its open source and salient features.
Mongodb is based on JSON the java script library and stores informaiton in BSON the Binary JSON format.
As a first step in mongodb, it often becomes necessary to practice commands, not queries any more in javascript format and this error is very common
> db.mycollection.insert{{hello:”learnersreference.com”}}
Jan 03 SyntaxError: Unexpected token {
In case of above error, check if we are in correct database
> db
test
This is a typical Syntax error, and we can simply fix this as follows
> db.mycollection.insert({hello:”world”})

Get MongoDB Articles for FREE:

Delivered by FeedBurner