tags

Hasura + NoSQL = 🚀 Announcing GA for MongoDB database support

31 August, 2023 | 4 min read

There have likely been times when you’ve wanted access to a tool that unlocks data in dynamic, declarative ways, but were stuck using a relational database. Or maybe you’ve wished you could more fluidly use NoSQL instead of tirelessly managing migrations.

We’ve got the solution for you!

Hasura is happy to announce the general availability of our MongoDB database connector.

Over the past couple of months, during our Beta offering, we’ve focused on creating the most performant read experience with MongoDB databases using Hasura’s underlying GraphQL technology.

With the Hasura MongoDB database connector, you can:

  • Instantly create a GraphQL API on MongoDB
  • Efficiently query between your MongoDB collections
  • Join a MongoDB connection to another data source

    … and more!

We've listened to your pain points and built a solution that simplifies the complex task of managing and querying your data while offering a seamless and efficient way to author your GraphQL schema over NoSQL (with MongoDB, specifically).

“We are looking to have GraphQL as our foundational approach for whatever data we serve to our applications, and Hasura’s gonna be the facilitator for piecing that together for us and not having to write our own resolvers. Our longer term vision has changed where we don’t want a data source that's going to tie us to a cloud provider, and using MongoDB with Hasura will help us be more cloud agnostic.”

- Fortune 500 healthcare services provider on migrating to MongoDB and modernizing their infrastructure with Hasura


Check out this video playlist on how to get started with setting up your MongoDB data with Hasura.

Generating your GraphQL schema for MongoDB

We’ve worked hard to enhance your experience authoring and generating a GraphQL schema on MongoDB using Hasura. Our goal is to help you normalize your unstructured NoSQL workloads using GraphQL, enabling a more structured strategy for interacting with your data.

Some of the improvements include:

  • Logical models are now available for MongoDB, allowing you to write and customize your schema for your MongoDB collections (and views).
  • This includes a new interface for importing schemas for collections from a single document sample, with the flexibility to share models and permissions across collections and even parts of collections (read more in our docs for more on how to author your own logical models).
  • Validation schemas remain accessible for inferring your schema directly from your database, adding an extra layer of convenience and efficiency (read more in our docs for more information on validation schemas in your MongoDB database).
  • The added ability to efficiently author in-database relationships between collections in your MongoDB database.
  • Enhancements to our query capabilities by introducing where clauses and permissions on embedded (or nested) documents, providing you with more control and precision in handling your data permission structures.
  • An additional enhancement for adding MongoDB views to your API, which allows for custom views of your data using aggregation pipelines.
  • Enhanced functionality for creating relationships between remote databases using GraphQL in Hasura, including a visual builder and the ability to specify your MongoDB collections as targets for remote relationships.

Blazing-fast queries

Our goal is to give you the tools to effortlessly work with large data sets and complex structures in MongoDB and other data sources. Our core query planning strategy revolves around sending the least amount of data while making the fewest requests to ensure optimal performance.

Some of the performance-enhancing strategies we've implemented include:

  • Field-level projection for document retrieval, even for embedded documents using runtime-generated `$where` queries.
  • Permissions are pushed down to the data source, which also includes embedded documents.
  • Within the database, cross-collection relationships are available through `$lookup` queries.
  • Lateral permissions across those relationships are made possible with query-level pushdowns.
  • We’ve also enabled cross-database joins between MongoDB and other data sources, with permissions handled at their respective data sources and the join itself taking place in-memory within Hasura.

These methodologies ensure a highly responsive and efficient querying experience, allowing you to manage your data with ease.

NoSQL, no restrictions

One of our core goals is that we want Hasura to be flexible enough to help you author your APIs and stay out of your way when you need it to.

A few ways our system stands out from our competitors include:

  • Allowing connections and relationships between MongoDB and other types of databases, something not commonly found with other providers.
  • Not placing unnecessary limits on your work with any fixed-system restrictions on depth limits or resolvers.
  • Using complex arrangements of data with our support for embedded array objects, adding more flexibility to your projects.
  • Offering the ability to host your API on your own premises, giving you more control over your hosting while also providing our own cloud-hosted version if you prefer (you can read more on setting up your Cloud Hasura instance with MongoDB).

Find out more about getting started with Hasura and MongoDB over here in our documentation.

The same Hasura you know and love

While providing all of these enhancements to MongoDB, we also have all the features you’ve come to know and love when authoring your APIs with Hasura, such as:

  • Secure authentication for providing user access to your API
  • Authorization and access control to keep your records safe and secure
  • Blazing-fast query compilation and execution
  • Query caching for even more performance on top of efficient query compiling
  • Data federation across different data sources
  • An integration framework for external business logic
  • Security for protecting against API scraping, malicious attacks, and excessive data exposure

What’s next?

We’re just getting started.

Over the following months, we’ll be working hard to support writing and updating documents in MongoDB and bring the same benefits we provide to the schema generation and read-layer of the database.

Keep an eye out for an upcoming Beta program for mutation support for MongoDB.



Subscribe IlluSubscribe Illu

Monthly product updates in your inbox. No spam.

Loading...