This guide will help you set up and use MongoDB Compass with your inventory management application.
- MongoDB Compass is installed on your system
- The application code is set up and ready to run
- Launch MongoDB Compass from your start menu or desktop shortcut
- In the connection dialog, enter:
mongodb://localhost:27017 - Click "Connect"
- If MongoDB is not running, Compass will offer to start it for you
- Once connected, click the "+" button next to "Databases"
- Create a new database named
inventory-management - Create an initial collection named
users
- Return to your application directory
- Run the application with:
npm run dev - The application will connect to your local MongoDB instance
- Make sure MongoDB is running through Compass
- Verify that you've created the
inventory-managementdatabase - Check that your
.env.localfile contains the correct connection string:MONGODB_URI=mongodb://localhost:27017/inventory-management
- By default, the local MongoDB instance doesn't require authentication
- If you've set up authentication, update your connection string to:
MONGODB_URI=mongodb://username:password@localhost:27017/inventory-management
MongoDB Compass provides a graphical interface to:
- View, create, update, and delete documents
- Create and manage indexes
- Analyze query performance
- Import and export data
To view your application data:
- Open MongoDB Compass
- Connect to your local MongoDB instance
- Select the
inventory-managementdatabase - Browse collections to view and manage data
After setting up your database:
- Create your first user account through the application signup page
- This will create the necessary collections in your database
- You can then view these collections in MongoDB Compass