MongoDB quiz questions

MongoDB interview questions

  • 1.

    Which of following command will return all items from inventory collection

    1. db.inventory.find( {} )

    2. db.inventory.find()

    3. db.inventory.findAll()

    Answer
  • 2.

    Create or insert operations add new documents to a collection. If the collection does not currently exist, insert operations will create the collection.

    1. True

    2. False

    Answer
  • 3.

    MongoDB provides the following methods to insert documents into a collection:

    • db.collection.insert()
    • db.collection.insertOne() New in version 3.2
    • db.collection.insertMany() New in version 3.2
    1. True

    2. False

    Answer
  • 4.

    Specify all correct statments regarding mongo shell

    1. print() to print without formatting

    2. print(tojson(<obj>)) to print with JSON formatting and equivalent to printjson()

    3. printjson() to print with JSON formatting and equivalent to print(tojson(<obj>))

    4. None of above

    Answer
  • 5.

    What function do you use to format the query results in mongo shell?

    1. pretty()

    2. format()

    3. print()

    Answer
  • 6.

    What command will you use to list all available databases?

    1. show dbs

    2. show databases

    3. show db

    4. show alldb

    Answer
  • 7.

    What command will you use to display the database you are using?

    1. db

    2. show db

    3. show all

    4. show databases

    Answer
  • 8.

    What is default port for MongoDB server?

    1. 12701

    2. 27017

    3. 27071

    4. 3306

    Answer
  • 9.

    The mongo shell is an interactive ______interface to MongoDB. You can use the mongo shell to query and update data as well as perform administrative operations.

    What is missing?

    1. Javascript

    2. NodeJS

    3. C++

    Answer

© 2017 QuizBucket.org