MongoDB Hackathon Guide
Background Photo by Alex Kotliarskyi / Unsplash
Hackathons are about building something awesome in a short amount of time. This guide was created to help you make use of MongoDB tools and avoid a lot of the overhead associated with setting up infrastructure and building API's so that you can begin to quickly get to the part that matters: building your awesome application.
Requirements
Before we begin building, we need to make sure several things are in place.
- Connectivity / Firewall. In order for you to build your project, you will need to be able to connect to your MongoDB database instance, you will need to have firewall ports open between your laptop and the MongoDB Database service on TCP/IP port 27017 at a minimum. You may need to submit a request to your IT team to ensure that port 27017 is open.
- Download MongoDB Shell. The mongo command shell gives you access to your databases regardless of whether they're on MongoDB Atlas, or on your laptop/desktop. You can download the MongoDB Package for your operating system and install it manually, or use a package manager. Instructions for installation are found on the docs site. You will need this in order to connect to the MongoDB Database you deploy in MongoDB Atlas.
- Download MongoDB Compass. Compass is a user interface that enables you to graphically manage and visualize your MongoDB Databases.
Part 1 - Leveraging MongoDB Atlas
Nearly every application will rely on a database. Setting up your database can be tedious with many solutions. Not so, with MongoDB. Not only is MongoDB simple to launch as a process locally on your laptop or desktop, but you can also run it even more simply in the cloud using MongoDB Atlas - MongoDB's database as a service — available starting for free at http://cloud.mongodb.com.
To help you get started, I've compiled the following steps into a series of videos you can watch here.
MongoDB Hackathon Guide - Introduction
- Step 1: Register for a MongoDB Atlas Account
- Step 2: Deploy a Database Cluster
- Step 3: Add a Database User
- Step 4: Configure an IP Whitelist Entry
- Step 5: Connect to your Database using MongoDB Compass
- Step 6: Connect to your Database using MongoDB Shell (mongo)
This entire process should take you not more than 30 minutes or so. Once we have the cluster up and running, with a user created, the security parameters set, we can then begin to focus on building the application.
Part 2 - Building your application
Once you have your database set up and ready to go, you can begin building your application. MongoDB Stitch was purpose-built specifically to help you build better applications faster.
The following list of screencasts will help you through the process of building a Stitch Application, importing some data and leveraging the MongoDB Stitch SDK to display that data in your web application.
- Step 7: Create a MongoDB Stitch App
- Step 8: Create a Rule for your Database and Collection
- Step 9: Create and import some mock data
- Step 10: Create a function to expose your data in an application via the Stitch SDK
Example Code
Resources
The fastest way to get started with a project at a hackathon is to leverage an automated system to deploy and manage your databases and your backend.
- MongoDB Downloads | Documentation
- MongoDB Atlas - Database as a Service | Documentation
- MongoDB Compass - User tool to help you manage and visualize your MongoDB data | Documentation
- MongoDB Stitch - MongoDB's Backend as a Service | Documentation
- MongoDB Charts - Analyze, Collaborate and Take Action on Your MongoDB Data | Documentation
- Visit the Stitch FAQ Online
- GitHub Repository