n8n community node for MongoDB operations with EJSON query parsing support
npm install @shoutoutlabs/n8n-nodes-mongodb-ejsonThis is an n8n community node that provides MongoDB operations with Extended JSON (EJSON) query parsing support. It allows you to work with MongoDB ObjectIds, Dates, and other BSON types using the standard MongoDB Extended JSON format.
n8n is a fair-code licensed workflow automation platform.
- Installation
- Operations
- Credentials
- EJSON Support
- Usage Examples
- Compatibility
- Resources
Follow the installation guide in the n8n community nodes documentation.
1. Go to Settings > Community Nodes
2. Select Install
3. Enter n8n-nodes-mongodb-ejson as the npm package name
4. Agree to the risks of using community nodes
The MongoDB EJSON node supports the following operations:
The node requires MongoDB API credentials with the following options:
mongodb://username:password@hostname:port/databaseThis node uses MongoDB's Extended JSON (EJSON) format, which allows you to represent BSON types in JSON. This is particularly useful for:
json
{"_id": {"$oid": "507f1f77bcf86cd799439011"}}
`$3
`json
{"createdAt": {"$date": "2023-01-01T00:00:00.000Z"}}
`$3
The node supports all EJSON representations including:
- {"$numberLong": "123456789"} for 64-bit integers
- {"$regex": "pattern", "$options": "flags"} for regular expressions
- {"$binary": {"base64": "data", "subType": "00"}} for binary dataUsage Examples
$3
`json
{
"operation": "find",
"collection": "users",
"query": "{\"_id\": {\"$oid\": \"507f1f77bcf86cd799439011\"}}"
}
`$3
`json
{
"operation": "insert",
"collection": "orders",
"data": "{\"userId\": {\"$oid\": \"507f1f77bcf86cd799439011\"}, \"amount\": 100, \"createdAt\": {\"$date\": \"2023-01-01T00:00:00.000Z\"}}"
}
`$3
`json
{
"operation": "update",
"collection": "orders",
"query": "{\"createdAt\": {\"$gte\": {\"$date\": \"2023-01-01T00:00:00.000Z\"}}}",
"updateData": "{\"$set\": {\"status\": \"processed\", \"updatedAt\": {\"$date\": \"2023-01-02T00:00:00.000Z\"}}}"
}
`$3
`json
{
"operation": "aggregate",
"collection": "sales",
"pipeline": "[{\"$match\": {\"date\": {\"$gte\": {\"$date\": \"2023-01-01T00:00:00.000Z\"}}}}, {\"$group\": {\"_id\": \"$category\", \"total\": {\"$sum\": \"$amount\"}}}]"
}
`$3
`json
{
"operation": "find",
"collection": "products",
"query": "{\"$and\": [{\"price\": {\"$gte\": 100}}, {\"category\": \"electronics\"}, {\"createdAt\": {\"$gte\": {\"$date\": \"2023-01-01T00:00:00.000Z\"}}}]}",
"sort": "{\"price\": -1}",
"limit": 10
}
``- ✅ Full EJSON Support: Native support for MongoDB Extended JSON format
- ✅ ObjectId Handling: Proper ObjectId parsing and serialization
- ✅ Date Support: Native Date object support through EJSON
- ✅ All MongoDB Operations: Find, Insert, Update, Delete, FindAndUpdate, FindAndReplace, Aggregate
- ✅ Advanced Options: Upsert, return document options, sorting, pagination
- ✅ Error Handling: Comprehensive error handling with detailed messages
- ✅ Connection Flexibility: Support for both connection strings and individual connection parameters
This node is compatible with:
- n8n version 1.0.0 and above
- MongoDB 4.0 and above
- Node.js 20.15 and above
- n8n community nodes documentation
- MongoDB Extended JSON documentation
- MongoDB Node.js Driver documentation
- BSON documentation