Heads up! To view this whole video, sign in with your Courses account or enroll in your free 7-day trial. Sign In Enroll
Start a free Courses trial
to watch this video
In this video, we'll update our POST /register route so that we can validate the user input from the registration form, and create a new document in MongoDB with the user's name, email, favorite book, and password.
Mongo Shell
Mongo Shell Cheatsheet
You first need to log into the Mongo shell — mongo
in the terminal for Macs and Linux, or start mongo.exe for Windows.
-
show dbs
— display the databases -
use bookworm
— specify the database you're going to work with -
show collections
— shows the document collections for the selected database -
db.users.find()
— display all the documents in theusers
collection -
db.users.find().pretty()
— nicer format for output documents within the shell -
db.users.drop()
— remove theusers
collection from the current database
Related Discussions
Have questions about this video? Start a discussion with the community and Treehouse staff.
Sign upRelated Discussions
Have questions about this video? Start a discussion with the community and Treehouse staff.
Sign up
You need to sign up for Treehouse in order to download course files.
Sign upYou need to sign up for Treehouse in order to set up Workspace
Sign up