npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

n8n-nodes-kingfoodmart-vietnam-mongoose-tss

v1.0.50

Published

n8n community node for MongoDB operations using Mongoose ODM

Readme

Kingfoodmart Mongoose - n8n Community Node

npm version License: MIT Node.js Version MongoDB


📋 Table of Contents


📦 Installation

Community Nodes (Recommended)

  1. Go to Settings > Community Nodes in your n8n instance
  2. Select Install
  3. Enter n8n-nodes-kingfoodmart-vietnam-mongoose-tss as the npm package name
  4. Agree to the risks of using community nodes
  5. Select Install

Manual Installation

# 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

🚀 Features

Core Capabilities

  • 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

Advanced Features

  • 🔄 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

🔧 Available Nodes

Kingfoodmart Mongoose (CRUD Operations)

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

Kingfoodmart Mongoose Change Stream (Real-time Trigger)

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

⚙️ Configuration

MongoDB Credentials

This package provides a comprehensive MongoDB credential system supporting various connection types and authentication methods.

Connection Types

Single Host Connection

Perfect for development and simple deployments:

Connection String: mongodb://localhost:27017/mydb
Database: myapp (optional override)
Replica Set Connection

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

Authentication Options

  • 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

Advanced Connection Options

| 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 |

📖 Usage Guide

Basic CRUD Operations

Create Documents

// Single document
{
  "name": "John Doe",
  "email": "[email protected]",
  "age": 30,
  "isActive": true
}

// Multiple documents
[
  {"name": "Alice", "email": "[email protected]"},
  {"name": "Bob", "email": "[email protected]"}
]

Query Documents

// 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"
  }
}

Field Selection

// 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}

Aggregation Pipeline

[
  {"$match": {"isActive": true}},
  {"$group": {
    "_id": "$department",
    "count": {"$sum": 1},
    "avgAge": {"$avg": "$age"}
  }},
  {"$sort": {"count": -1}},
  {"$limit": 10}
]

Real-time Change Monitoring

Basic Change Stream Setup

// Monitor all changes in users collection
Collection: "users"
Watch Level: "Collection"
Operation Types: ["insert", "update", "delete"]
Output Format: "Simplified"

Advanced Change Stream Configuration

// 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
}

Advanced Features

Date Conversion

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"}
}

Debug Mode

Enable debug mode in Options for detailed logging:

  • Connection status and performance
  • Query execution details
  • Change stream events
  • Error diagnostics

🔍 Examples

E-commerce Order Processing

// 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}}"}

User Activity Tracking

// 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}}
]

Data Synchronization

// Sync changes to external system
Collection: "products"
Operation Types: ["insert", "update", "delete"]
Resume Token: "{{$json.last_resume_token}}"
Output Format: "Full"

🛠️ Troubleshooting

Common Issues

Connection Problems

# Error: "Failed to connect to MongoDB"
✅ Check connection string format
✅ Verify MongoDB server is running
✅ Check network connectivity and firewall
✅ Validate authentication credentials

Change Stream Issues

# 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

Performance Issues

# Slow query performance
✅ Add appropriate indexes
✅ Use projection to limit fields
✅ Optimize match filters
✅ Enable debug mode for analysis

Debug Mode

Enable debug mode in node options for detailed logging:

  • Connection diagnostics
  • Query execution plans
  • Change stream events
  • Performance metrics
  • Error stack traces

Best Practices

Production Deployment

  • ✅ 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

Performance Optimization

  • ✅ 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

Security

  • ✅ Use strong authentication credentials
  • ✅ Enable SSL/TLS for production
  • ✅ Limit database user permissions
  • ✅ Regularly rotate credentials
  • ✅ Monitor access logs

📞 Contact & Support

For technical support, questions, or collaboration:

📧 Email: [email protected]


📄 License

This project is licensed under the MIT License - see the LICENSE.md file for details.