use mydb

Category: Databases & SQL

use mydb

Switch to a database

Sets the current database for the session. MongoDB creates databases lazily, so use mydb alone creates nothing until the first write. Related: show dbs, show collections.
Looking for more? Search all 7,657 commands — works offline, in English or Spanish, and fixes typos.