You don't need a CREATE command: use school switches to a database, and it is created when you first store data in it.
Collections are also created automatically on the first insert. You can create one explicitly (for example with validation rules) with db.createCollection("students").
Mastering MongoDB Create Database & Collection helps you write clean and reliable MongoDB code. Follow standard conventions, test edge cases, and keep logic simple. Try running the code example below and complete the exercises to build confidence.
MongoDB Create Database & Collection Code Example
MongoDB
use school
db.createCollection("students")
show collections
Output
switched to db school
{ ok: 1 }
students
Run this example on your own computer. The "Get Started" lesson shows how to set it up.
MongoDB Create Database & Collection Practice Exercises
Check what you learned in “MongoDB Create Database & Collection”.