Introduction Flashcards
1
Q
How do you create a database in MongoDB?
A
use database_name;
2
Q
How do you switch databases?
A
use database_name;
3
Q
What are tables in MongoDB called?
A
Collections
4
Q
What are records in MongoDB called?
A
Documents
5
Q
How do you display all the documents in a collection?
A
db.collection_name.find();
6
Q
How do you see all the databases in your MongoDB server?
A
show databases;
7
Q
How do you end a session in MongoDB?
A
quit()
8
Q
How do you see all the collections within a database?
A
show collections;
9
Q
How do you create a collection?
A
db.collection_name.insertOne();
10
Q
How are document IDs created in MongoDB?
A
MongoDB automatically generates IDs for each document.