Create Your First NoSQL Database with MongoDB and Compass | Week 1

Graded Quiz

1. What command would you use to create a database using the MongoDB shell?


show <database_name>

use <database_name>

2. Is it possible to store totally different and unrelated documents inside a collection?



3. What does the command

      title: 'Second Post'
      $unset: {
          tags: ['hello_world']

It adds the string ‘hello_world’ to the array stored inside the tags field of a document with the field title set to ‘Second Post’

It updates the tags field of a document with the title ‘Second Post’ by removing its content and change it to the array [‘hello_world’]

It removes the tags field from a document with title ‘Second Post’

4. What does the command

    $set: {
      <field_name>: 'string'

Since the filter {} catches all documents in the collection, It will update all documents in the collection and set the <field_name> to ‘string’

It updates one document in the collection and set the <field_name> to ‘string’

5. What are some of the capabilities of MongoDB Compass?

Analyze the contents of a collection

Use the Schema section in order to learn some queries

Show and edit documents in a collection

6. Does a query returning in 0 ms automatically mean that is efficient?



7. What is the purpose of an unique index?

It makes the index created the only one allowed in a collection.

Beside the other advantages of an index, it specifies that we don’t want the index to have any duplicates.

There is no difference compared to a normal index.

* The material and content uploaded on this website are for general information and reference purposes only.

Please do it by your own first! Protection Status

0 0 votes
Article Rating
Notify of

Inline Feedbacks
View all comments
close button
Would love your thoughts, please comment.x