In a sharded replica set environment, the w Option provides ability for write concern and j Option provides
ability for the data to be written on disk journal. Consider that we have a seven member replica set and we
want to assure that the writes are committed to journal.
What should be the value of j?
A. 1
B. 2
C. 0
D. 7
Which of the following operators is used to updated a document partially?
A. $set
B. $update
C. $project
D. $modify
Which option can be used with update command so that a new document gets created if no matching document is found based on the query condition?
A. upsert command instead of update command
B. {update: true, insert: true} as the third parameter of update command
C. This has to be handled in application code (Node.js, PHP, JAVA, C#, etc.) and cannot be handled in mongo shell query
D. Specify {upsert : true } as the third parameter of update command
MongoDB is
A. None of the above
B. Object-oriented DBMS
C. Relational DBMS
D. Document-oriented DBMS
You have designed a web application with mongoDB. You have configured replication. The replica set is in place and function properly. What happens in case of failure?
A. Switchover needs to be done manually
B. Failover happens automatically
C. Switchover happens automatically
D. Failover needs to be done manually
Which of the following operator can be used to limit the number of documents in an array field of a document after an update is performed?
A. $arrayLimit
B. $push along with $each, $sort and $slice
C. $removeFromSet
D. None of the above
The________operator can be used to identify an element in the array to be updated without explicitly specifying the position of the element.
A. $ elemMatch
B. $slice
C. Updating an array field without knowing its index is not possible.
D. $
The difference between $push and $addToSet is:
A. $addToSet needs the fields to be already present while $push will work even if the field is not present
B. $addToSet adds the item to the field only if it does not exist already; while $push pushes the item to the field irrespective of whether it was present or not
C. $addToSet adds the item to the field only if the new item is of the same datatype
D. There is no major difference between them. $addToSet is a deprecated version of $push.
What is the output of following two commands in MongoDB: db. posts. insert({n_id":l}) db.posts.insert ({"_id":l})
A. Two documents will be inserted with _id as 1
B. MongoDB will automatically increment the _id of the second document as 2
C. This will throw a duplicate key error
D. It will insert two documents and throw a warning to the user
Which of the following does MongoDB use to provide High Scalability?
A. Replication
B. Write Concern
C. Indexing D. Sharding