Q1. Which command adds members to the replica set from MongoDB shell?

Q2. Which MongoDB shell command should you use to back up a database?

Q3. Which shell query displays all citizens with an age greater than or equal to 21?

Q4. What does a MongoDB collection consist of?

Q5. Given an ObjectId in _id, how do you get the time it was created?

Q6. Given a cursor named myCursor, which command returns a boolean value?

Q7. Which command returns a specific document in the user’s collection?

Q8. To import a JSON array into Mongo, what flags are needed with MongoDBimport?

Q9. Choose the shell command that connects to a MongoDB database.

Q10. In the MongoDB shell, how can you tell if an index was used with a query?

Q11. Suppose your aggregation pipeline terminated with an exception referring to exceeded memory limit. What is the best way to resolve the issue?

Q13. What the primary database in a replica set fails, when does failover begin?

Q14. What is the correct option to set up Kerberos when starting MongoDBd?

Q15. What is the purpose of an arbiter in a replica set?

Q16. You want to know how many types of items you have in each category. Which query does this?

Q17. To restrict the number of records coming back from a query, which command should you use?

Q18. You have a collection named restaurants with the geographical information stored in the location property, how do you create a geospatial index on it?

Q19. How do you find documents with a matching item in an embedded array?

Q20. Which query bypasses the first 5 customers and returns the next 10?

Q21. How do you create a text index?

Q22. Assuming you have customers collection with a firstName and lastName field, which is the correct MongoDB shell command to create an index on lastName, then firstName both ascending?

Q23. One of the documents in your collection has an _id based upon an older database design and you want to change it. You write an update command to find the document and replace the _id but the _id isn’t changed. How should you fix the issue?

Q24. A compound index allows you to _ ?

Q25. Why are ad-hoc queries useful?

Q26. How often do the members of a replica set send heartbeats to each other?

Q27. Which command returns all of the documents in the customers collection?

Q28. Given a cursor named myCursor, pointing to the customers collection, how to you get basic info about it?

Q29. What is true about indexes?

Q30. What is the preferred format to store geospatial data in MongoDB?

Q31. Which programming language is used to write MongoDB queries? (Alternative: In the MongoDB shell, what programming language is used to make queries?)

Q32. You have two text fields in your document and you’d like both to be quickly searchable. What should you do?

Q33. To import a CSV file into MongoDB, which command should you issue?

Q34. In an MongoDB mapReduce command, the reduce function should _.

Q35. On a newly created collection, which field will have an index?

Q36. You have a collection of thousands of students. You’d like to return the second set of 20 documents from the sorted collection. What is the proper order in which to apply the operations?

Q37. You would like the stats() command to return kilobytes instead of bytes. Which command should you run?

Q38. You want to modify an existing index. What is the best way to do this?

Q39. You need to delete the index you created on the description field. Which command will accomplish this?

Q40. You would like to know how many different categories you have. Which query will best get the job done?

Note: count() works with find(…) but length works with distinct

Q41. From the MongoDB shell, how do you create a new document in the customers collection?

Q42. Which field is required of all MongoDB documents?

Q43. A MongoDB instance has at least what three files?

Q44. You’d like a set of documents to be returned in last name, ascending order. Which query will accomplish this?

Q45. What is NOT a standard role in MongoDB?

Q46. Which MongoDB shell command deletes a single document?

Q47. Using the MongoDB shell, how do you remove the customer collection and its indexes?

Q48. By default, applications direct their read operations to which member of the replica set?

Q49. You need to get the names of all the indexes on your current collection. What is the best way to accomplish this?

Q50. You are going to do a series of updates to multiple records. You find setting the multi option of the update() command too tiresome. What should you do instead?

Q51. To cleanly shut down MongoDB, what command should you use from the MongoDB shell?

Q52. Given a customer collection which includes fields for gender and city, which aggregate pipeline shows the number of female customers in each city? (Alternative: How can you view the execution performance statistics for a query?)

Q53. When no parameters are passed to explain(), what mode does it run in?

Q54. What is the correct query to find all of the people who have a home phone number defined?

Q55. Which file in the MongoDB directly holds the MongoDB daemon?

Q56. You have just secured your previously unsecured MongoDB server, but the server is still not requiring authentication. What is the best option?

Q57. What is the most accurate statement regarding MongoDB and ad hoc queries?

Q58. In MongoDB, what does a projection do?

Q59. To remove a database and all of its records from MongoDB, what operator should you use?

Q60. What option can be passed to start the MongoDB shell without connecting to a database?

Q61. How can you improve the appearance of the output JSON that contains the _id?

Q62. What happens to a Replica set oplog if it runs out of memory?

Q63. MongoDB ships with a variety of files. Which file runs the MongoDB shell?

Q64. How can you view the execution performance statistics for a query?

Q65. From the MongoDB shell, how do you execute a JavaScript file named list.js?

Q66. Which MongoDB shell query will sort the customer’s collection by name descending?

Q67. Suppose you are using the mongoimport command to import personnel data and there is a unique index on the email field. What happens when there are duplicate emails in the import?

Q68. You have a collection with millions of documents. Each time you attempt to sort. MongoDB runs out of memory. What might help?

Q69. You need to be able to quickly find a word in a text field. What should you do?

Q70. Which field is always included in a projection unless specifically excluded?


Q71. After installing MongoDB on your machine, what must you do before launching Mongo?

mongodb site

Q72. How does a --jsonArray file need to be structured?

Section blog

Q73. From the MongoDB shell, how do you display all of a database’s memory usage?

Q74. How do you create a new MongoDB user?

MongoDB documentation

Q75. What is the internal data structure of a MongoDB document?

MongoDB documentation

Q76. Which projection shows only the FirstName and lastName fields of a document in the customers collection?

Q77. Documents in mongodb are atomic at the ___ level

MongoDB reference

Q78. What should the priority of a member be in order to prevent it from becoming the primary in replica set?

MongoDB reference

Q79. You need to add an index to the large name collection in your production database. You do not want to have disruption of service for your users and you can’t afford to have a team to do the work during after hours. What should you do?

MongoDB reference

Q80. When using aggregation $convert. which is not a parameter?

MongoDB reference

Q81. All tag values in tag sets must be _.

MongoDB reference