- 📦 Installation
- 🚀 Features
- 🔧 Available Nodes
- ⚙️ Configuration
- 📖 Usage Guide
- 🔍 Examples
- 🛠️ Troubleshooting
- 🤝 Contributing
- 📄 License
- Go to Settings > Community Nodes in your n8n instance
- Select Install
- Enter
n8n-nodes-kingfoodmart-vietnam-mongoose-tss
as the npm package name - Agree to the risks of using community nodes
- Select Install
# For n8n installed globally
npm install -g n8n-nodes-kingfoodmart-vietnam-mongoose-tss
# For n8n installed locally
npm install n8n-nodes-kingfoodmart-vietnam-mongoose-tss
- ✅ Full CRUD Operations - Create, Read, Update, Delete with advanced options
- ✅ Real-time Change Streams - Monitor MongoDB changes instantly
- ✅ Aggregation Pipeline - Complex data processing and analytics
- ✅ Schema Validation - Mongoose ODM integration with type conversion
- ✅ Replica Set Support - High availability and production-ready connections
- ✅ Connection Management - Automatic connection handling and pooling
- ✅ Error Handling - Comprehensive error management and debugging
- 🔄 Date Conversion - Automatic string-to-date conversion based on schema
- 📊 Query Optimization - Built-in query performance monitoring
- 🎯 Field Selection - Projection support for optimized data transfer
- 🔐 Authentication - Support for various MongoDB authentication methods
- 📝 Debug Mode - Detailed logging for development and troubleshooting
- 🚀 Production Ready - Optimized for high-performance workflows
Professional MongoDB operations node with comprehensive CRUD functionality.
Supported Operations:
- Create - Insert new documents with schema validation
- Find - Query multiple documents with filtering, sorting, and pagination
- Find One - Query single document with field selection
- Update/Update One - Modify existing documents with upsert support
- Delete/Delete One - Remove documents with safety checks
- Aggregate - Run complex aggregation pipelines with date conversion
- Count - Count documents matching query criteria
Real-time MongoDB Change Stream trigger for monitoring database changes.
Key Features:
- Real-time Monitoring - Instant notifications on data changes
- Multiple Watch Levels - Collection, database, or deployment-wide monitoring
- Operation Filtering - Filter by insert, update, delete, and other operations
- Resume Capability - Continue monitoring from specific points using resume tokens
- Custom Filtering - Advanced match filters and projections
- Multiple Output Formats - Full event, document only, or simplified format
- Count - Count documents matching query criteria
This package provides a comprehensive MongoDB credential system supporting various connection types and authentication methods.
Perfect for development and simple deployments:
Connection String: mongodb://localhost:27017/mydb
Database: myapp (optional override)
Production-ready high availability setup:
Hosts: rs1.example.com:27017,rs2.example.com:27017,rs3.example.com:27017
Username: myuser
Password: mypassword
Replica Set Name: rs0
Auth Source: admin
Database: myapp
-
Auth Source: Database to authenticate against (typically
admin
for replica sets) - SSL/TLS: Secure connections with certificate validation
- Connection Pooling: Optimized connection management
- Timeouts: Configurable connection and socket timeouts
Option | Description | Default |
---|---|---|
Connection Timeout | Time to establish connection | 10000ms |
Socket Timeout | Socket operation timeout | 10000ms |
Max Pool Size | Maximum connections in pool | 10 |
Min Pool Size | Minimum connections in pool | 0 |
SSL | Enable secure connections | false |
SSL Validate | Validate SSL certificates | true |
// Single document
{
"name": "John Doe",
"email": "john@example.com",
"age": 30,
"isActive": true
}
// Multiple documents
[
{"name": "Alice", "email": "alice@example.com"},
{"name": "Bob", "email": "bob@example.com"}
]
// Basic queries
{"isActive": true}
{"age": {"$gte": 18, "$lte": 65}}
{"name": {"$regex": "John", "$options": "i"}}
// Complex queries
{
"isActive": true,
"age": {"$gte": 18},
"status": {"$in": ["active", "premium"]},
"createdAt": {
"$gte": "2024-01-01T00:00:00.000Z",
"$lt": "2024-12-31T23:59:59.999Z"
}
}
// Include specific fields
{"_id": 1, "name": 1, "email": 1, "createdAt": 1}
// Exclude sensitive fields
{"password": 0, "internalNotes": 0}
// Mixed selection
{"_id": 0, "name": 1, "email": 1, "profile.bio": 1}
[
{"$match": {"isActive": true}},
{"$group": {
"_id": "$department",
"count": {"$sum": 1},
"avgAge": {"$avg": "$age"}
}},
{"$sort": {"count": -1}},
{"$limit": 10}
]
// Monitor all changes in users collection
Collection: "users"
Watch Level: "Collection"
Operation Types: ["insert", "update", "delete"]
Output Format: "Simplified"
// Schema Definition
{
"name": {"type": "String"},
"email": {"type": "String"},
"created_at": {"type": "Date"},
"is_active": {"type": "Boolean"}
}
// Match Filter (only active users)
{
"fullDocument.status": "active",
"operationType": {"$in": ["insert", "update"]}
}
// Projection (reduce data transfer)
{
"fullDocument.name": 1,
"fullDocument.email": 1,
"operationType": 1,
"clusterTime": 1
}
Automatic string-to-date conversion based on schema definition:
// Schema with date fields
{
"created_at": {"type": "Date"},
"updated_at": {"type": "Date"},
"birth_date": {"type": "Date"}
}
// Query with string dates (automatically converted)
{
"created_at": {"$gte": "2024-01-01T00:00:00.000Z"}
}
Enable debug mode in Options for detailed logging:
- Connection status and performance
- Query execution details
- Change stream events
- Error diagnostics
// Monitor new orders in real-time
Collection: "orders"
Operation Types: ["insert"]
Match Filter: {"fullDocument.status": "pending"}
Output Format: "Document"
// Update order status
Operation: "updateOne"
Query: {"_id": "{{$json.orderId}}"}
Update Data: {"status": "processing", "updated_at": "{{$now}}"}
// Track user login events
Collection: "user_sessions"
Operation Types: ["insert", "update"]
Match Filter: {"fullDocument.event_type": "login"}
// Aggregate user activity
Pipeline: [
{"$match": {"event_type": "login"}},
{"$group": {"_id": "$user_id", "login_count": {"$sum": 1}}},
{"$sort": {"login_count": -1}}
]
// Sync changes to external system
Collection: "products"
Operation Types: ["insert", "update", "delete"]
Resume Token: "{{$json.last_resume_token}}"
Output Format: "Full"
# Error: "Failed to connect to MongoDB"
✅ Check connection string format
✅ Verify MongoDB server is running
✅ Check network connectivity and firewall
✅ Validate authentication credentials
# Error: "Change stream failed to initialize"
✅ Ensure MongoDB 3.6+ with replica set
✅ Check user permissions for change streams
✅ Verify collection exists
✅ Review match filter syntax
# Slow query performance
✅ Add appropriate indexes
✅ Use projection to limit fields
✅ Optimize match filters
✅ Enable debug mode for analysis
Enable debug mode in node options for detailed logging:
- Connection diagnostics
- Query execution plans
- Change stream events
- Performance metrics
- Error stack traces
- ✅ Use replica sets for high availability
- ✅ Configure appropriate connection pooling
- ✅ Set up proper authentication and SSL
- ✅ Monitor connection and query performance
- ✅ Implement proper error handling in workflows
- ✅ Use indexes for frequently queried fields
- ✅ Limit result sets with projection
- ✅ Use aggregation for complex operations
- ✅ Monitor and optimize slow queries
- ✅ Configure appropriate batch sizes for change streams
- ✅ Use strong authentication credentials
- ✅ Enable SSL/TLS for production
- ✅ Limit database user permissions
- ✅ Regularly rotate credentials
- ✅ Monitor access logs
For technical support, questions, or collaboration:
📧 Email: hoanh.nguyen@kingfoodmart.com
This project is licensed under the MIT License - see the LICENSE.md file for details.
⭐ If this package helps your workflow, please consider giving it a star on npm!
Made with ❤️ by Kingfoodmart Vietnam
© 2024 Kingfoodmart. All rights reserved.