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

v0.1.3

Published

Extended MongoDB node with authentic MongoDB query syntax, advanced update operators, update pipelines, arrayFilters, bulk operations, type coercion and more.

Readme

🤝 n8n node MongoDb Ex (tended)

n8n-nodes-mongodb-ex

An extended n8n MongoDB node, tailor-made for native MongoDB developers. This node goes beyond the built-in MongoDB node by providing authentic MongoDB query syntax, advanced update operators, update pipelines, arrayFilters, bulk operations, type coercion and more.

Table of Contents

Overview

MongoDB Extended (MongoDbEx) is a drop-in replacement for n8n’s base MongoDB node with a richer, MongoDB-native developer experience:

  • Use real MongoDB query syntax and aggregation pipelines
  • Leverage advanced update operators and update pipelines
  • Target array elements precisely with arrayFilters and positional operators
  • Perform single or bulk operations (insertMany/updateMany/bulkWrite)
  • Automatic type coercion for ObjectId and ISO dates
  • Subnode support - use it as a tool for AI Agents

Installation

Follow the community nodes installation guide, then search for and install n8n-nodes-mongodb-ex.

Alternatively, install directly:

npm install n8n-nodes-mongodb-ex

For Docker-based deployments, add to your n8n Docker image:

RUN cd /usr/local/lib/node_modules/n8n && npm install n8n-nodes-mongodb-ex

Features

  • MongoDB-native queries and pipelines
  • Advanced update operators: $set, $unset, $inc, $push, $pull, etc.
  • Update pipelines supported (array of stages)
  • Array element targeting with arrayFilters
  • Bulk operations: insertMany, updateMany, bulkWrite
  • JSON input for queries, documents, updates
  • Automatic type coercion of 24-hex ObjectId strings and ISO date strings
  • Upsert support for updates

Operations

  • Aggregate: Run full MongoDB aggregation pipelines
  • Find: Query documents using native MongoDB operators
  • Insert: Insert one or many documents
  • Update: Update one or many documents with operators or update pipelines
  • FindOneAndUpdate: Atomic find-and-update with full MongoDB update support
  • FindOneAndReplace: Atomic find-and-replace
  • Delete: Delete by native MongoDB filter

Type Coercion

ObjectId and Date values are automatically handled through and through.

Input

{
  "_id": "507f1f77bcf86cd799439011",
  "name": "John Doe",
  "orders": [
    {
      "productId": "66d6215f9b3c4a18e0f7a2c1",
      "quantity": 2,
      "timestamp": "2025-02-03T18:46:00Z"
    }
  ],
  "createdAt": "2024-01-15T10:44:00Z"
}

Saved DB Document

{
  "_id": ObjectId("507f1f77bcf86cd799439011"),
  "name": "John Doe",
   "orders": [
    {
      "productId": ObjectId("66d6215f9b3c4a18e0f7a2c1"),
      "quantity": 2,
      "timestamp": ISODate("2025-02-03T18:46:00Z")
    }
  ],
  "createdAt": ISODate("2024-01-15T10:44:00Z")
}

$oid and $toDate operators in pipelines are recognized and respected. Any manual type conversions you may already have in place will not be overwritten.

Usage Examples

📑 Advanced Update with arrayFilters

Filter:

{ "_id": 12345 }

Update:

{
  "$set": {
    "orders.$[elem].status": "shipped",
    "orders.$[elem].shippedAt": "2024-01-15T10:00:00Z"
  }
}

arrayFilters:

  [{"elem.status": "pending"}]

📜 Update Pipeline

Filter:

{
  "_id": {
    "type": "counter",
    "metric": "orders_summary"
  } 
}

Update (pipeline):

[
  {
    "$set": {
      "totalSpent": {"$add": ["$totalSpent", "$currentOrder.amount"]},
      "lastOrderDate": "$$NOW",
      "orderCount": {"$add": ["$orderCount", 1]}
    }
  },
  {
    "$push": {
      "logs": { "message": "Stats updated", "timestamp": "$$NOW" }
    } 
  }
]

⏬ Aggregation (pipeline):

[
  {
    "$match": {"status": "active"}
  },
  {
    "$lookup": {
      "from": "orders",
      "localField": "_id",
      "foreignField": "userId",
      "as": "userOrders"
    }
  },
  {
    "$group": {
      "_id": "$department",
      "totalOrders": {"$sum": {"$size": "$userOrders"}},
      "avgOrderValue": {"$avg": "$userOrders.total"}
    }
  }
]

🛒 Bulk Insert with Type Coercion

Executes a single updateMany call for all inputs.

Input:

{
  [
    {
      "_id": "507f1f77bcf86cd799439011",
      "createdAt": "2024-01-15T10:00:00Z",
      "name": "John Doe"
    },
    {
      "_id": "507f1f77bcf86cd799439012",
      "createdAt": "2024-01-15T11:00:00Z",
      "name": "Jane Smith"
    }
  ]
}

Many:

Set to true


🚚 Bulk Write

This operation expects each input to already of valid MongoDB bulk operation shape (insertOne, updateOne, updateMany, deleteOne, deleteMany, replaceOne). See documentation

Input:

{
  [
    {
      "updateOne": {
        "filter": { "_id": "507f1f77bcf86cd799439011" },
        "update": { 
          "$set": { "name.last": "Doe" },
          "$currentDate": { "timestamp": true }
        }
      }
    },
    {
      "updateOne": {
        "filter": { "_id": "507f1f77bcf86cd799439013" },
        "update": {
          "$set": { "active": false }
          "$currentDate": { "timestamp": true }
        }
      }
    }
  ]
}

Compatibility

  • n8n >= 0.187.0
  • Node.js >= 20.15
  • MongoDB >= 4.4

License

MIT