Please Install our Kuizzer app ! ---- Doesn't Know how to install click here!

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?

db.createDatabase(“<database_name>”)

show <database_name>

use <database_name>


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

No

Yes


3. What does the command

db.posts.update({
  {
      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

db.<collection_name>.update({
    {},
    $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?

No

Yes


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!

DMCA.com Protection Status

0 0 votes
Article Rating
Subscribe
Notify of
guest

0 Comments
Inline Feedbacks
View all comments
KUIZZER Helping Educational website for Youngers

Welcome To Kuizzer!

KUIZZER - Helping Educational Website for YoungersYour Post is going to visible like this

Here, Your Promotional Details are going to visible for others whenever they visit the site !

AdBlock Detected

Looks like you are using an ad-blocking browser extension. We request you to whitelist our website on the ad-blocking extension and refresh your browser to view the content.

Check out our merchandise, available at kuizzer.in

X
0
Would love your thoughts, please comment.x
()
x