MongoDB MCQ Questions - Document
This section focuses on "Document" in MongoDB. These Multiple Choice Questions (MCQs) should be practiced to improve the MongoDB skills required for various interviews (campus interview, walk-in interview, company interview), placements, entrance exams and other competitive examinations.
1. MongoDB stores data records as ______.
A. ZSON documents.
B. JSON documents
C. BSON documents
D. WSON documents.
View Answer
Ans : C
Explanation: MongoDB stores data records as BSON documents. BSON is a binary representation of JSON documents, though it contains more data types than JSON.
2. To insert data into MongoDB collection, you need to use MongoDB's __________ method.
A. save()
B. insert()
C. Both A and B
D. Can not say
View Answer
Ans : C
Explanation: To insert data into MongoDB collection, you need to use MongoDBs insert() or save() method.
3. The basic syntax of insert() command is?
A. db.insertCOLLECTION_NAME(document)
B. db.COLLECTION_NAME.insert(document)
C. COLLECTION_NAME.insert(document)
D. db.COLLECTION_NAME.create(document)
View Answer
Ans : B
Explanation: db.COLLECTION_NAME.insert(document)
4. _id is ________ bytes hexadecimal number unique for every document in a collection.
A. 4
B. 8
C. 10
D. 12
View Answer
Ans : D
Explanation: _id is 12 bytes hexadecimal number unique for every document in a collection.
5. To query data from MongoDB collection, you need to use MongoDB ______ method.
A. select()
B. find()
C. show()
D. All of the above
View Answer
Ans : B
Explanation: To query data from MongoDB collection, you need to use MongoDB's find() method.
6. find() method will display all the documents in a __________ way.
A. structured
B. non-structured
C. simple
D. complex
View Answer
Ans : B
Explanation: find() method will display all the documents in a non-structured way.
7. To display the results in a formatted way, you can use _______ method.
A. beautify()
B. simple()
C. pretty()
D. unify()
View Answer
Ans : C
Explanation: To display the results in a formatted way, you can use pretty() method.
8. Apart from the find() method, there is findOne() method, that returns only one document.
A. TRUE
B. FALSE
C. Can be true or false
D. Can not say
View Answer
Ans : A
Explanation: True, Apart from the find() method, there is findOne() method, that returns only one document.
9. The update() method updates the values in the existing document.
A. TRUE
B. FALSE
C. Can be true or false
D. Can not say
View Answer
Ans : A
Explanation: True, The update() method updates the values in the existing document.
10. MongoDB _________ method is used to delete a document from the collection.
A. drop()
B. remove()
C. delete()
D. None of the above
View Answer
Ans : B
Explanation: MongoDB's remove() method is used to remove a document from the collection.
Discussion