π Using the Library Database
Select the library databaseβ
π» We'll use the library
database for all of the hands-on exercises in this lab. If you haven't already, import the library data into your database cluster.
- Atlas UI
- MongoDB Shell
Select the correct database in the aggregation pipeline builder.
To do that, in a MongoDB shell, type:
use library
You can show all collections with:
show collections
π¦ΈββοΈ π» How would you switch to a database called orders
?
Extra activity! Do it if you have extra time or are following along at home. It won't be covered during the hands-on lab.
Answer
use orders
Even if this database does not yet exist, MongoDB can change to it. If we create a collection, users, etc., then this DB will be created.
Remember to get back to the library database by using:
use library
π¦ΈββοΈ Showing all databasesβ
Extra activity! Do it if you have extra time or are following along at home. It won't be covered during the hands-on lab.
You can also list other databases in your MongoDB instance with:
show databases