Skip to main content

MongoDB

Create an API with MongoDB data

Connecting MongoDB to Sparky

Connecting to MongoDB

Sparky supports connecting to managed MongoDB databases, including MongoDB Atlas Clusters. MongoDB Atlas Serverless Instances aren't yet supported.

  1. In Sparky, go to app.sparky.codes/resources/new/mongodb
  2. Enter the connection details for your database. You can enter each field individually, or enter a connection string.

MongoDB connection fields

  1. Click Test Connection to test the connection. This attempts to briefly open a connection with your database server to ensure Sparky can connect.
  2. When creating a new endpoint, configure a MongoDB query for that endpoint by selecting your MongoDB resource under a Resource Query step.
  1. Write a MongoDB query directly in the endpoint step. They will be executed when this API endpoint is called.

Supported methods

Sparky supports the following MongoDB methods:

  • find
  • findOne
  • count
  • insertOne
  • updateOne
  • deleteOne

Allowlist Sparky's IP Addresses

Sparky connects to your database from the following IP Addresses:

IP Addresses
44.206.127.10/32
44.207.131.252/32

Ensure your database allows inbound TCP connections from these IP addresses on port 27017.