Skip to main content

Documentation Index

Fetch the complete documentation index at: https://docs.spojit.com/llms.txt

Use this file to discover all available pages before exploring further.

The MongoDB connector lets your workflows interact with any MongoDB instance, including MongoDB Atlas, self-hosted clusters, and single-node deployments.

Editor experience

Fields that take a MongoDB query, update, or aggregation pipeline (filter, update, pipeline, command, documents, projection, sort) render as a JSON editor — paste or type your queries directly without escaping. Misspelled MongoDB operators are flagged inline with a suggestion. Typing $grater_than shows Did you mean $gt?. Aggregation variables ($$ROOT, $$NOW) and the positional update marker ($) are recognised and never flagged.

Connection setup

You can connect using either a connection string (recommended for Atlas) or individual credentials.
1

Choose your connection method

Option A — Connection String (recommended for MongoDB Atlas):
  • Copy the connection string from your Atlas dashboard (e.g., mongodb+srv://user:pass@cluster.mongodb.net/mydb)
Option B — Individual credentials (for self-hosted or direct connections):
  • Host (e.g., localhost or mongo.example.com)
  • Port (default: 27017)
  • Username and Password
  • Database (optional — default database)
  • Auth Source (optional — authentication database, usually admin)
2

Add the connection in Spojit

Go to Connections in Spojit, click Add Connection, select MongoDB, and enter either:
  • Connection String: Your full MongoDB URI, or
  • Host, Port, Username, Password, Database, and Auth Source fields
MongoDB Atlas: Copy the connection string from your cluster’s Connect dialog. Make sure your IP is in the Atlas network access list.

Common MongoDB settings

ProviderConnection methodNotes
MongoDB AtlasConnection string (mongodb+srv://...)Add IP to network access list
Self-hostedHost + credentialsEnsure auth is enabled

Tools

Execute any MongoDB database command such as ping, dbStats, collStats, createUser, etc.
command
object
required
MongoDB command object.
database
string
Database to run the command against. Defaults to the connection’s database.
Example request:
{
  "command": { "dbStats": 1 }
}
Example response:
{
  "success": true,
  "data": {
    "db": "myapp",
    "collections": 12,
    "objects": 45230,
    "dataSize": 15728640,
    "ok": 1
  }
}
collection
string
required
Collection name.
filter
object
MongoDB query filter (e.g., { "status": "active" }).
projection
object
Fields to include (1) or exclude (0).
sort
object
Sort order (1 for ascending, -1 for descending).
limit
number
Maximum number of documents to return (default: 100).
skip
number
Number of documents to skip.
Example request:
{
  "collection": "orders",
  "filter": { "status": "shipped" },
  "projection": { "orderId": 1, "total": 1, "customer": 1 },
  "sort": { "createdAt": -1 },
  "limit": 5
}
Example response:
{
  "success": true,
  "data": {
    "documents": [
      { "_id": "665a...", "orderId": "ORD-1234", "total": 99.99, "customer": "Alice" },
      { "_id": "665b...", "orderId": "ORD-1233", "total": 149.50, "customer": "Bob" }
    ],
    "count": 2
  }
}
collection
string
required
Collection name.
documents
object[]
required
Array of documents to insert.
Example request:
{
  "collection": "users",
  "documents": [
    { "name": "Alice", "email": "alice@example.com", "role": "admin" },
    { "name": "Bob", "email": "bob@example.com", "role": "user" }
  ]
}
Example response:
{
  "success": true,
  "data": {
    "insertedCount": 2,
    "insertedIds": { "0": "665a...", "1": "665b..." }
  }
}
collection
string
required
Collection name.
filter
object
required
Query filter to match documents.
update
object
required
Update operations using MongoDB operators ($set, $inc, $push, etc.).
upsert
boolean
Insert a new document if no match is found (default: false).
Example request:
{
  "collection": "users",
  "filter": { "role": "user" },
  "update": { "$set": { "verified": true } }
}
Example response:
{
  "success": true,
  "data": {
    "matchedCount": 42,
    "modifiedCount": 42,
    "upsertedCount": 0,
    "upsertedId": null
  }
}
collection
string
required
Collection name.
filter
object
required
Query filter to match documents to delete.
Example request:
{
  "collection": "sessions",
  "filter": { "expiresAt": { "$lt": "2024-01-01T00:00:00Z" } }
}
Example response:
{
  "success": true,
  "data": {
    "deletedCount": 256
  }
}
collection
string
required
Collection name.
pipeline
object[]
required
Aggregation pipeline stages ($match, $group, $sort, $project, $lookup, etc.).
Example request:
{
  "collection": "orders",
  "pipeline": [
    { "$match": { "status": "completed" } },
    { "$group": { "_id": "$customer", "totalSpent": { "$sum": "$total" }, "orderCount": { "$sum": 1 } } },
    { "$sort": { "totalSpent": -1 } },
    { "$limit": 10 }
  ]
}
Example response:
{
  "success": true,
  "data": {
    "documents": [
      { "_id": "Alice", "totalSpent": 1250.00, "orderCount": 12 },
      { "_id": "Bob", "totalSpent": 980.50, "orderCount": 8 }
    ],
    "count": 2
  }
}
List all databases accessible with the current credentials. No parameters required.Example response:
{
  "success": true,
  "data": {
    "databases": [
      { "name": "admin", "sizeOnDisk": 40960 },
      { "name": "myapp", "sizeOnDisk": 15728640 },
      { "name": "analytics", "sizeOnDisk": 8388608 }
    ],
    "totalSize": 24158208
  }
}
database
string
Database name. Defaults to the connection’s database.
Example response:
{
  "success": true,
  "data": {
    "collections": [
      { "name": "users", "type": "collection" },
      { "name": "orders", "type": "collection" },
      { "name": "system.views", "type": "collection" }
    ]
  }
}
collection
string
required
Collection name.
filter
object
Query filter. Counts all documents if omitted.
Example request:
{
  "collection": "users",
  "filter": { "status": "active" }
}
Example response:
{
  "success": true,
  "data": {
    "count": 1542
  }
}