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
Storing session data in RAM is fine for development, but would quickly crash a production server. In this lesson learn how to use a MongoDB-based data store for your session variables, which provides a scalable solution for a production server.
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
Resources
- connect-mongo A MongoDB session store for Connect and Express
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