MongoDB Data API

Number of APIs: 9

This collection is an introduction to the MongoDB Data API. The Data API provides you with a REST-like access to your data in MongoDB Atlas, the database-as-a-service offering by MongoDB.

You can find the full documentation on the MongoDB Data API on the documentation website.

Getting Started

To test out the MongoDB Data API collection, start by creating a free MongoDB Atlas cluster.

Once you have a cluster, you can [fork this collection] into your own workspace so you'll be able to use it with your own variables.

Once you have a cluster up and running, enable the Data API.

From the Atlas UI, copy the URL endpoint provided for the Data API, and paste the value in your URL_ENDPOINT collection variable.

Still in the Atlas UI, create a new API key, copy the value and paste it in the API_KEY collection variable.

With the EJSON format, you can benefit from MongoDB’s Extended JSON format, which preserves many data types that are normally not supported by JSON (such as ObjectID, Date, and more).

For writes, the {{CONTENT_TYPE}} variable is required and can be set to either json or ejson. This variable is used by Qodex in the Content-Type header.

For reads, the Data API returns JSON by default, but can be changed to EJSON by setting the Accept header. You can set the {{CONTENT_TYPE}} variable to json or ejson to change the default behavior. Changing this variable will change the Accept header when Qodex does a request to the Data API. The default content type returned by Atlas can also be changed in the Atlas Admin UI.

Fill in the other variables with the appropriate values for your cluster, database, and collection names.

You can now explore the various endpoints and see how to perform CRUD operations on your collection using the MongoDB Data API.

  1. Delete Many Documents POST {{URL_ENDPOINT}}/action/deleteMany

  2. Run Aggregation Pipeline POST {{URL_ENDPOINT}}/action/aggregate

  3. Insert Document POST {{URL_ENDPOINT}}/action/insertOne

  4. Find Document POST {{URL_ENDPOINT}}/action/findOne

  5. Update Document POST {{URL_ENDPOINT}}/action/updateOne

  6. Delete Document POST {{URL_ENDPOINT}}/action/deleteOne

  7. Insert Multiple Documents POST {{URL_ENDPOINT}}/action/insertMany

  8. Update Multiple Documents POST {{URL_ENDPOINT}}/action/updateMany

  9. Find Multiple Documents POST {{URL_ENDPOINT}}/action/find