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?
Set the replace option to true.
Use the replaceOne() command instead.
You can’t. Once set, the _id field cannot be changed.✔️
Use the updateOne() command instead.
Q24. A compound index allows you to _ ?
Calculate interest quickly.
Accomplish nothing, since compound indexes aren’t allowed in Mongo.
Use more than one field per index.
Combine fields in different collations.✔️
Q25. Why are ad-hoc queries useful?
They do not have to use the same operators.
You do not need to structure the database to support them.
They autogenerate reports.
They run faster than indexed queries.✔️
Q26. How often do the members of a replica set send heartbeats to each other?
every 2 minutes
every 5 seconds
every 2 seconds✔️
every 10 seconds
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?
They speed up read access while slowing down writes.✔️
They secure the database from intruders.
They speed up reads and writes.
They speed up write access while slowing down reads.
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?
Create a text index on each field.✔️
MongoDB is not able to do this.
Create a compound text index using both fields.
Create a text index on one field and a single field index on the other.
Q33. To import a CSV file into MongoDB, which command should you issue?
Q34. In an MongoDB mapReduce command, the reduce function should _.
access the database
be called only when the key has a single value
access the database only to perform read operations
not access the data✔️
Q35. On a newly created collection, which field will have an index?
the name field
the ObjectId field
the _id field✔️
no 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?
limit, skip, sort
sort, limit, skip
limit, sort, skip
sort, skip, limit✔️
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?
Use the reIndex() command to modify the index.
Delete the original index and create a new index.✔️
Call the createIndex() command with the update option.
Use the updateIndex() command.
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?
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?
mongoDB is schema-less so no field is required
Q43. A MongoDB instance has at least what three files?
data, namespace, and journal✔️
namespace, journal, and log
journal, data, and database
data, log, and journal
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?
Use the replaceMany() command instead
Use the updateMulti() command instead
Use the updateMany() command instead✔️
Set the global multi option to True
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?)
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?
Use the reIndex() command to add the index quickly.
Use the createIndex() command with the option background = true.✔️
Use the createIndex() command.
Use the createIndex() command with the option parallel = true.