Get Started with MongoDB in Hasura Cloud
This guide will help you get set up with Hasura Cloud and our MongoDB integration. This is the easiest way to set up Hasura Engine and the MongoDB GraphQL Data Connector.
Hasura GraphQL Engine
Try it out
Step 1: Create an account on Hasura Cloud and create a new Hasura Project
Create a project on Hasura Cloud and hit the "Launch Console" button to open the Hasura Console for your project.
Step 2: Connect to MongoDB
From the Console, visit
Manage to connect your MongoDB database.
Connect your database using the following details:
- Database Name: (visual name of the database in Hasura)
- Connection: (in the format of
- db: (name of the MongoDB database being connected to)
Step 3: Tracking Collections
Once your database has been connected, select the database name from the left-hand sidebar.
You should see your
users Collection listed here. Select it, and select
Since MongoDB is a NoSQL database, Documents can be variable within each of the Collections. Hasura supports and recommends defining a logical model for each Collection which will define the Document schema.
We also support optionally generating a schema automatically from your database's validation schema if one is available.
You will now see a modal with a few options for setting up your Collection's schema.
- Infer Schema from Document allows you to take a single Document from your Collection and infer the
- Use Existing Logical Model allows you to select a previously created logical model.
- Use Database Schema allows you to use your database's validation schema if one is present in your database (a GraphQL schema will be automatically generated for you).
Your Collection has now added to your GraphQL API! 🎉
By default, this Collection is only available to
admin users. To make it available for more user groups, select the
Collection name from the left-hand sidebar, and select
Permissions to setup permission rules for the Collection. You
can read more about permissions here.
Step 4: Running your first query
Click on the API tab in the Console navigation which will take you to GraphiQL, our API testing tool.
Utilize the explorer located on the left-hand sidebar to assist you in composing your query (the resulting query will be populated in the body area). When you’re ready, click on the play button to execute your GraphQL query. Your query’s result will be populated in the right-hand column of the interface.
Keep up to date
If you'd like to stay informed about the status of MongoDB support, subscribe to our newsletter and join our Discord!