Skip to content

Severe Query Performance Issue with Mongoose 8.9.5 #15194

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
2 tasks done
totomers opened this issue Jan 22, 2025 · 16 comments
Closed
2 tasks done

Severe Query Performance Issue with Mongoose 8.9.5 #15194

totomers opened this issue Jan 22, 2025 · 16 comments
Milestone

Comments

@totomers
Copy link

Prerequisites

  • I have written a descriptive issue title
  • I have searched existing issues to ensure the performance issue has not already been reported

Last performant version

"^6.8.1"

Slowed down in version

"^8.9.4"

Node.js version

18.x

🦥 Performance issue

I'm facing a severe performance issue with Mongoose v8.9.5. Despite the MongoDB explain output showing lightning-fast query execution on the database, Mongoose is inexplicably taking an unreasonably long time to return results.

For example, the following simple query takes around 700 ms, however, when using the native mongodb driver the result is returned in 60ms.

 console.time("mongoose");

     await Business.findById(new ObjectId("673e24037abe20cc29e0225b")).lean();

    console.timeEnd("mongoose");
 

Output: 695.934ms

   console.time("Native MongoDB Driver");

    await db
      .collection("businesses")
      .findOne({ _id: new ObjectId("673e24037abe20cc29e0225b") });

    console.timeEnd("Native MongoDB Driver");

Output: 64.584ms

I suspect this could be related to how Mongoose processes the query or interacts with MongoDB in this version. The problem persists despite having the appropriate indexes in place and minimal query execution time reported by MongoDB.

Environment:

Node.js Version: v18.20.4
Mongoose Version: v8.9.5
MongoDB Driver Version: v6.12.0 (mongoose dependency)
MongoDB Server Version: 8.0.4 (Atlas Cluster)
OS: Amazon Linux 2 (AWS Lambda)

This occurred only after I updated the mongoose version from v6.8.1 to v8.9.5, and the MongoDB Server Version from 6.0.0 to 8.0.4

Could this be a bug in Mongoose v8.9.5? What else can I try to find the cause of this slowdown?

What I’ve Tried For Each Query:

  1. Verified that MongoDB itself is not at fault (query execution is fast per explain()).
  2. Ensured proper indexing on the collection fields.
  3. Added mongoose.set('debug', true) to confirm the query being executed is correct.
  4. Cleared npm cache and reinstalled dependencies to rule out dependency corruption.
  5. Checked with MongoDB support to double check it doesn't show up as a slow operation.

Could this be a regression or specific issue with Mongoose v8.9.5? Is there any additional debugging you recommend to pinpoint the cause of this delay?

Steps to Reproduce

1. Define the schema and create a million mock documents:

const TransactionSchema = new mongoose.Schema({
  businessId: { type: mongoose.Schema.Types.ObjectId, required: true },
  acquirerTransactionId: { type: String, index: true },
  partnerReferenceId: { type: String, index: true },
  tempUniqueId: { type: String, index: true },
  transactionTime: { type: Date, index: true },
});

const Transaction = mongoose.model("Transaction", TransactionSchema);

Use the following code to connect to MongoDB and log the Mongoose and MongoDB driver versions:*


import mongoose from "mongoose";

mongoose.Promise = global.Promise;
let isConnected;

export const connectToDatabase = () => {
  if (isConnected) {
    console.log("DB connection was previously established");
    return Promise.resolve();
  }
  console.log("Establishing a new DB connection...");
  console.log(`Mongoose version: ${mongoose?.version}`);

  const DB_URL = "mongodb+srv://<username>:<password>@<cluster>.mongodb.net/dbname";
  mongoose.set("strictQuery", true);

  return mongoose
    .connect(DB_URL, { maxIdleTimeMS: 60000 })
    .then((db) => {
      isConnected = db.connections[0].readyState;
      try {
        const connection = mongoose.connection;
        const driverInfo = connection?.client?.s?.options?.metadata;

        if (driverInfo) {
          console.log(`MongoDB Driver Info:`, driverInfo);
        } else {
          console.log("Driver info is not accessible.");
        }
      } catch (error) {
        console.error("Error accessing MongoDB driver info:", error);
      }
    })
    .catch((err) => {
      console.error("Connection error:", err);
    });
};

connectToDatabase();

3. Execute the query:

const result = await Transaction.findOne({
  $or: [
    { acquirerTransactionId: "502109000037" },
    { partnerReferenceId: "502109000037" },
    { tempUniqueId: "502109000037" },
  ],
  businessId: "673e24037abe20cc29e0225b",
});
console.log("Query result:", result);

4. Observe the following:

Always takes more than around 1 second.
MongoDB query execution time (based on explain) is ~1 millisecond.

5. Run the explain() on the query directly on MongoDB, and see that the winning plan looks optimal. Here’s the relevant snippet of what I got:

{
  "queryPlanner": {
    "winningPlan": {
      "stage": "FETCH",
      "filter": { "businessId": { "$eq": "673e24037abe20cc29e0225b" } },
      "inputStage": {
        "stage": "OR",
        "inputStages": [
          {
            "stage": "IXSCAN",
            "keyPattern": { "acquirerTransactionId": 1 },
            "indexBounds": { "acquirerTransactionId": [ "[\"502109000037\", \"502109000037\"]" ] }
          },
          {
            "stage": "IXSCAN",
            "keyPattern": { "tempUniqueId": 1 },
            "indexBounds": { "tempUniqueId": [ "[\"502109000037\", \"502109000037\"]" ] }
          },
          {
            "stage": "IXSCAN",
            "keyPattern": { "partnerReferenceId": 1 },
            "indexBounds": { "partnerReferenceId": [ "[\"502109000037\", \"502109000037\"]" ] }
          }
        ]
      }
    }
  },
  "executionStats": {
    "executionTimeMillis": 1,
    "totalKeysExamined": 1,
    "totalDocsExamined": 1
  }
}

Expected Behavior

The query should return results in a reasonable time frame (similar to the MongoDB execution time, with minimal additional overhead).

@totomers
Copy link
Author

It's worth noting that the issue is not observed in 6.12.9, but is observed in Mongoose 6.13.8.

After the Atlas Version 8.0.4 was set, I tested the following Mongoose versions to limit the scope of the issue:

mongoose 8.9.5 (+ native MongoDB driver 6.12.0) - significant time delays.

mongoose 8.9.4 (+ native MongoDB driver 6.12.0) - significant time delays.

mongoose 8.9.0 (+ native MongoDB driver 6.12.0) - significant time delays.

mongoose 8.9.0 (+ native MongoDB driver 6.10.0 override) - significant time delays.

mongoose 7.8.4 (+ native MongoDB driver 5.9.2) -significant time delays.

mongoose 6.13.8 (+ native MongoDB driver 4.17.2) - significant time delays.

mongoose 6.12.9 (+ native MongoDB driver 4.17.2) - Fast response!

@vkarpov15 vkarpov15 added this to the 8.10.1 milestone Feb 10, 2025
@vkarpov15
Copy link
Collaborator

Are you able to bisect the exact version any further? Specifically, I suspect the culprit may be 6.13.4 and #15043, but I would like to confirm.

@clamb-dunbar
Copy link

For what it's worth; I've also experienced the same slow queries when using mongoose vs mongo drivers (6.13.0). Tracked it down to the change occurring between these 2 versions of mongoose.
8.8.1 fast
8.8.2 slow

@vkarpov15
Copy link
Collaborator

@clamb-dunbar that's another data point in favor of #15039 / #15043, which was also released in 8.8.2. Can you give me an idea of how much % of performance regression you're seeing? Also, what does your build system look like and are you using any tools that augment Node.js stack traces?

@clamb-dunbar
Copy link

clamb-dunbar commented Feb 11, 2025

It's very early in the project lifecycle so don't have much logging. It's all built using gha; but the package management is handled by renovate-bot so ensure that we don't roll new version out unless we test them.
Mongo call to get the value from a collection with only 1 record in it was ~ 50ms with the rest of the endpoint overhead; replaced that same call using a mongoose model and it was around 800ms.

edit after totmers posted My project is indeed running inside a Lambda so consistent with their findings

@totomers
Copy link
Author

Update - Mongoose Performance Issue and Fix

After upgrading Mongoose from version 6.12.9 to 8.10.0, queries executed inside AWS Lambda using the Serverless Framework became four times slower. However, the same queries remained fast when executed outside the framework (e.g., locally, in a manually deployed Lambda, or using the native MongoDB driver).

Extensive debugging revealed that the issue was not caused by Mongoose itself but rather by how it was bundled inside the Lambda function when using esbuild. Moving Mongoose to an AWS Lambda Layer restored optimal query performance. The fix was to explicitly exclude mongoose and mongodb in the esbuild configuration (exclude: ["mongoose", "mongodb"]). This ensured that the Lambda function used the version from the Lambda Layer instead of bundling its own copy, which resolved the performance issue.

Possible Cause

My theory is that this might be due to dynamic imports within the Mongoose module, which were affected by esbuild's tree shaking when packaging the Lambda function. Could this be the case? If so, is there a way to overcome this so Mongoose doese not need to be moved to an AWS Lambda Layer?

Alternative Solutions Tried

Upgrading esbuild and serverless-esbuild and including mongoose and mongodb in the esbuild bundle did not resolve the issue:

"esbuild": "^0.24.2"

"serverless-esbuild": "^1.54.6"

@vkarpov15
Copy link
Collaborator

We haven't tried Mongoose with esbuild, so we don't know right now but we will find out. @clamb-dunbar are you also using esbuild?

@clamb-dunbar
Copy link

Yes. Building with a sam template that uses esbuild.

@vkarpov15 vkarpov15 modified the milestones: 8.10.1, 8.10.2 Feb 14, 2025
@vkarpov15
Copy link
Collaborator

I wasn't able to repro this locally using esbuild:

import mongoose from "mongoose";

const MONGO_URI = "mongodb://localhost:27017/testdb"; // Update with your database

// Define User schema and model
const userSchema = new mongoose.Schema({
  name: String,
  email: { type: String, unique: true },
  age: Number,
}, { timestamps: true });

const User = mongoose.model("User", userSchema);

async function main() {
  try {
    // Connect to MongoDB
    await mongoose.connect(MONGO_URI);

    // Clear existing users (optional)
    await User.deleteMany({});
    console.log("Cleared existing users");

    // Insert a user
    const newUser = await User.create({ name: "Alice", email: "[email protected]", age: 30 });
    console.log("Inserted user:", newUser);

    // Fetch all users
    const start = Date.now();
    const users = await User.find();
    console.log("All users:", users, Date.now() - start);

  } catch (error) {
    console.error("Error:", error);
  } finally {
    await mongoose.disconnect();
    console.log("Disconnected from MongoDB");
  }
}

// Run the script
main();

Output:

$ npx esbuild index.mjs --bundle --platform=node --outfile=dist/script.js

  dist/script.js  2.6mb ⚠️

⚡ Done in 57ms
$ node ./dist/script.js 
Cleared existing users
Inserted user: {
  name: 'Alice',
  email: '[email protected]',
  age: 30,
  _id: new ObjectId('67b358cf3efd8e4dd6c1a284'),
  createdAt: 2025-02-17T15:42:07.381Z,
  updatedAt: 2025-02-17T15:42:07.381Z,
  __v: 0
}
All users: [
  {
    _id: new ObjectId('67b358cf3efd8e4dd6c1a284'),
    name: 'Alice',
    email: '[email protected]',
    age: 30,
    createdAt: 2025-02-17T15:42:07.381Z,
    updatedAt: 2025-02-17T15:42:07.381Z,
    __v: 0
  }
] 3
Disconnected from MongoDB

We will try to set up serverless framework with Lambda to see if we can repro there.

@vkarpov15
Copy link
Collaborator

Still unable to repro on AWS Lambda with serverless. Below is my handler.mjs:

import mongoose from "mongoose";

const MONGO_URI = process.env.MONGO_URI; // Use an environment variable

const userSchema = new mongoose.Schema({
  name: String,
  email: { type: String, unique: true },
  age: Number,
}, { timestamps: true });

const User = mongoose.model("User", userSchema);

export async function main(event) {
  try {
    await mongoose.connect(MONGO_URI);
    console.log("Connected to MongoDB");

    await User.deleteMany({});

    // Insert a user (example)
    const newUser = await User.create({ name: "Lambda User", email: "[email protected]", age: 25 });
    console.log("Inserted user:", newUser);

    // Fetch all users
    const start = Date.now();
    const user = await User.findOne();

    return {
      statusCode: 200,
      body: JSON.stringify({ user, elapsedMS: Date.now() - start }),
    };
  } catch (error) {
    console.error("Error:", error);
    return {
      statusCode: 500,
      body: JSON.stringify({ error: error.message }),
    };
  } finally {
    await mongoose.disconnect();
    console.log("Disconnected from MongoDB");
  }
}

Here's my serverless.yaml with Atlas connection string omitted

service: mongoose-lambda

provider:
  name: aws
  runtime: nodejs18.x
  region: us-east-1
  environment:
    MONGO_URI: "XYZ"

functions:
  app:
    handler: handler.main
    events:
      - httpApi:
          path: /
          method: get

package:
  patterns:
    - node_modules/**
    - handler.mjs

custom:
  esbuild:
    bundle: true
    minify: true
    external: []
    platform: node
    target: node18

Output looks like this:

{"user":{"_id":"67b3619f81bfa5087f657659","name":"Lambda User","email":"[email protected]","age":25,"createdAt":"2025-02-17T16:19:43.214Z","updatedAt":"2025-02-17T16:19:43.214Z","__v":0},"elapsedMS":3}

Mongoose version 8.10.1, [email protected].

If you're running into this issue, can you please provide more detailed repro instructions? I would need a complete serverless.yaml (make sure to omit connection string etc) and exact version of serverless you're using @clamb-dunbar @totomers

@vkarpov15 vkarpov15 added can't reproduce Mongoose devs have been unable to reproduce this issue. Close after 14 days of inactivity. and removed performance labels Feb 17, 2025
@vkarpov15 vkarpov15 removed this from the 8.10.2 milestone Feb 17, 2025
@clamb-dunbar
Copy link

I've been using a sam template.yaml - i'll try and spend some time today making an example for you

@vkarpov15
Copy link
Collaborator

What is "sam" in this context?

@clamb-dunbar
Copy link

@clamb-dunbar
Copy link

@vkarpov15 After much poking of things; it looks like the problem occurs when enabling Sourcemap for the esbuild section of the sam template. If i'm on mongoose 8.8.1 that has no affect, under mongoose 8.8.2 having that set as true results in things being much slower - toggle it to false and the performance returns.

Metadata:
  BuildMethod: esbuild
  BuildProperties:
    Sourcemap: true
    EntryPoints:
      - src/noauth-api.ts

@hansgen
Copy link

hansgen commented Feb 25, 2025

Just wanted to chime in we're experiencing a 2-4x performance degradation as well in our product after upgrading from <8.8.2 to 8.10.1.

We're using AWS CDK, NodeJS, Typescript. AWS CDK bundles the lambda using esbuild.

Disabling sourcemaps restored the performance.

Pseudocode -- this is what we used to do

import { NodejsFunction } from 'aws-cdk-lib/aws-lambda-nodejs';

new NodejsFunction(this, 'my-function', {
   bundling: {
      sourceMap: true
   },
   environment: {
      NODE_OPTIONS:  '--enable-source-maps'
   }
});

package.json

"devDependencies": {
    "esbuild": "^0.25.0",
    "aws-cdk-lib": "^2.179.0",
}

Snapshot of performance of a randomly chosen Lambda before/after:

Image

@vkarpov15 vkarpov15 removed the can't reproduce Mongoose devs have been unable to reproduce this issue. Close after 14 days of inactivity. label Feb 25, 2025
@vkarpov15 vkarpov15 modified the milestones: 8.11.1, 8.12.1, 8.12.2 Feb 25, 2025
@zvickery
Copy link

Maybe related to this, it seems like #15039 causes some of our validators to fail under test with ValidationError: Maximum call stack size exceeded. If I back out that change manually, everything works as expected. Still trying to understand how these two things are related though.

@vkarpov15 vkarpov15 modified the milestones: 8.12.2, 8.12.3 Mar 21, 2025
@vkarpov15 vkarpov15 removed this from the 8.13.1 milestone Mar 28, 2025
@vkarpov15 vkarpov15 modified the milestones: 8.13.2, 8.13.3 Mar 28, 2025
vkarpov15 added a commit that referenced this issue Apr 6, 2025
feat: add skipOriginalStackTraces option to avoid stack trace performance overhead
@vkarpov15 vkarpov15 modified the milestones: 8.13.3, 8.14 Apr 6, 2025
KleilsonSantos added a commit to KleilsonSantos/Mongo-RestFull-API that referenced this issue May 23, 2025
![snyk-top-banner](https://res.cloudinary.com/snyk/image/upload/r-d/scm-platform/snyk-pull-requests/pr-banner-default.svg)


<h3>Snyk has created this PR to upgrade mongoose from 8.12.1 to
8.14.1.</h3>

:information_source: Keep your dependencies up-to-date. This makes it
easier to fix existing vulnerabilities and to more quickly identify and
fix newly disclosed vulnerabilities when they affect your project.

<hr/>


- The recommended version is **7 versions** ahead of your current
version.

- The recommended version was released **22 days ago**.



<details>
<summary><b>Release notes</b></summary>
<br/>
  <details>
    <summary>Package name: <b>mongoose</b></summary>
    <ul>
      <li>
<b>8.14.1</b> - <a
href="https://redirect.github.com/Automattic/mongoose/releases/tag/8.14.1">2025-04-29</a></br><h1>8.14.1
/ 2025-04-29</h1>
<ul>
<li>fix: correct change tracking with maps of arrays of primitives and
maps of maps <a class="issue-link js-issue-link" data-error-text="Failed
to load title" data-id="3020119547" data-permission-text="Title is
private" data-url="Automattic/mongoose#15374"
data-hovercard-type="pull_request"
data-hovercard-url="/Automattic/mongoose/pull/15374/hovercard"
href="https://redirect.github.com/Automattic/mongoose/pull/15374">#15374</a>
<a class="issue-link js-issue-link" data-error-text="Failed to load
title" data-id="2990690538" data-permission-text="Title is private"
data-url="Automattic/mongoose#15350"
data-hovercard-type="issue"
data-hovercard-url="/Automattic/mongoose/issues/15350/hovercard"
href="https://redirect.github.com/Automattic/mongoose/issues/15350">#15350</a></li>
<li>fix(populate): consistently convert Buffer representation of UUID to
hex string to avoid confusing populate assignment <a class="issue-link
js-issue-link" data-error-text="Failed to load title"
data-id="3028671691" data-permission-text="Title is private"
data-url="Automattic/mongoose#15383"
data-hovercard-type="pull_request"
data-hovercard-url="/Automattic/mongoose/pull/15383/hovercard"
href="https://redirect.github.com/Automattic/mongoose/pull/15383">#15383</a>
<a class="issue-link js-issue-link" data-error-text="Failed to load
title" data-id="3028403612" data-permission-text="Title is private"
data-url="Automattic/mongoose#15382"
data-hovercard-type="issue"
data-hovercard-url="/Automattic/mongoose/issues/15382/hovercard"
href="https://redirect.github.com/Automattic/mongoose/issues/15382">#15382</a></li>
<li>docs: add TypeScript Query guide with info on lean() + transform()
<a class="issue-link js-issue-link" data-error-text="Failed to load
title" data-id="3025739184" data-permission-text="Title is private"
data-url="Automattic/mongoose#15377"
data-hovercard-type="pull_request"
data-hovercard-url="/Automattic/mongoose/pull/15377/hovercard"
href="https://redirect.github.com/Automattic/mongoose/pull/15377">#15377</a>
<a class="issue-link js-issue-link" data-error-text="Failed to load
title" data-id="2909610525" data-permission-text="Title is private"
data-url="Automattic/mongoose#15311"
data-hovercard-type="issue"
data-hovercard-url="/Automattic/mongoose/issues/15311/hovercard"
href="https://redirect.github.com/Automattic/mongoose/issues/15311">#15311</a></li>
</ul>
      </li>
      <li>
<b>8.14.0</b> - <a
href="https://redirect.github.com/Automattic/mongoose/releases/tag/8.14.0">2025-04-25</a></br><h1>8.14.0
/ 2025-04-25</h1>
<ul>
<li>feat: upgrade MongoDB driver -&gt; 6.16 <a class="issue-link
js-issue-link" data-error-text="Failed to load title"
data-id="3018517569" data-permission-text="Title is private"
data-url="Automattic/mongoose#15371"
data-hovercard-type="pull_request"
data-hovercard-url="/Automattic/mongoose/pull/15371/hovercard"
href="https://redirect.github.com/Automattic/mongoose/pull/15371">#15371</a></li>
<li>feat: implement Query findById methods <a class="issue-link
js-issue-link" data-error-text="Failed to load title"
data-id="2964535745" data-permission-text="Title is private"
data-url="Automattic/mongoose#15337"
data-hovercard-type="pull_request"
data-hovercard-url="/Automattic/mongoose/pull/15337/hovercard"
href="https://redirect.github.com/Automattic/mongoose/pull/15337">#15337</a>
<a href="https://redirect.github.com/sderrow">sderrow</a></li>
<li>feat(subdocument): support schematype-level minimize option to
disable minimizing empty subdocuments <a class="issue-link
js-issue-link" data-error-text="Failed to load title"
data-id="2964364490" data-permission-text="Title is private"
data-url="Automattic/mongoose#15336"
data-hovercard-type="pull_request"
data-hovercard-url="/Automattic/mongoose/pull/15336/hovercard"
href="https://redirect.github.com/Automattic/mongoose/pull/15336">#15336</a>
<a class="issue-link js-issue-link" data-error-text="Failed to load
title" data-id="2916407638" data-permission-text="Title is private"
data-url="Automattic/mongoose#15313"
data-hovercard-type="issue"
data-hovercard-url="/Automattic/mongoose/issues/15313/hovercard"
href="https://redirect.github.com/Automattic/mongoose/issues/15313">#15313</a></li>
<li>feat: add skipOriginalStackTraces option to avoid stack trace
performance overhead <a class="issue-link js-issue-link"
data-error-text="Failed to load title" data-id="2973087871"
data-permission-text="Title is private"
data-url="Automattic/mongoose#15345"
data-hovercard-type="pull_request"
data-hovercard-url="/Automattic/mongoose/pull/15345/hovercard"
href="https://redirect.github.com/Automattic/mongoose/pull/15345">#15345</a>
<a class="issue-link js-issue-link" data-error-text="Failed to load
title" data-id="2803911966" data-permission-text="Title is private"
data-url="Automattic/mongoose#15194"
data-hovercard-type="issue"
data-hovercard-url="/Automattic/mongoose/issues/15194/hovercard"
href="https://redirect.github.com/Automattic/mongoose/issues/15194">#15194</a></li>
<li>fix(model): disallow Model.findOneAndUpdate(update) and fix
TypeScript types re: findOneAndUpdate <a class="issue-link
js-issue-link" data-error-text="Failed to load title"
data-id="3009226624" data-permission-text="Title is private"
data-url="Automattic/mongoose#15365"
data-hovercard-type="pull_request"
data-hovercard-url="/Automattic/mongoose/pull/15365/hovercard"
href="https://redirect.github.com/Automattic/mongoose/pull/15365">#15365</a>
<a class="issue-link js-issue-link" data-error-text="Failed to load
title" data-id="3006742365" data-permission-text="Title is private"
data-url="Automattic/mongoose#15363"
data-hovercard-type="issue"
data-hovercard-url="/Automattic/mongoose/issues/15363/hovercard"
href="https://redirect.github.com/Automattic/mongoose/issues/15363">#15363</a></li>
<li>types: correctly recurse in InferRawDocType <a class="issue-link
js-issue-link" data-error-text="Failed to load title"
data-id="2997936879" data-permission-text="Title is private"
data-url="Automattic/mongoose#15357"
data-hovercard-type="pull_request"
data-hovercard-url="/Automattic/mongoose/pull/15357/hovercard"
href="https://redirect.github.com/Automattic/mongoose/pull/15357">#15357</a>
<a class="issue-link js-issue-link" data-error-text="Failed to load
title" data-id="2581233621" data-permission-text="Title is private"
data-url="Automattic/mongoose#14954"
data-hovercard-type="issue"
data-hovercard-url="/Automattic/mongoose/issues/14954/hovercard"
href="https://redirect.github.com/Automattic/mongoose/issues/14954">#14954</a>
<a
href="https://redirect.github.com/JavaScriptBach">JavaScriptBach</a></li>
<li>types: include virtuals in toJSON and toObject output if virtuals:
true set <a class="issue-link js-issue-link" data-error-text="Failed to
load title" data-id="2975132650" data-permission-text="Title is private"
data-url="Automattic/mongoose#15346"
data-hovercard-type="pull_request"
data-hovercard-url="/Automattic/mongoose/pull/15346/hovercard"
href="https://redirect.github.com/Automattic/mongoose/pull/15346">#15346</a>
<a class="issue-link js-issue-link" data-error-text="Failed to load
title" data-id="2920983347" data-permission-text="Title is private"
data-url="Automattic/mongoose#15316"
data-hovercard-type="issue"
data-hovercard-url="/Automattic/mongoose/issues/15316/hovercard"
href="https://redirect.github.com/Automattic/mongoose/issues/15316">#15316</a></li>
<li>types: make init hooks types accurately reflect runtime behavior <a
class="issue-link js-issue-link" data-error-text="Failed to load title"
data-id="2953291245" data-permission-text="Title is private"
data-url="Automattic/mongoose#15331"
data-hovercard-type="pull_request"
data-hovercard-url="/Automattic/mongoose/pull/15331/hovercard"
href="https://redirect.github.com/Automattic/mongoose/pull/15331">#15331</a>
<a class="issue-link js-issue-link" data-error-text="Failed to load
title" data-id="2900387338" data-permission-text="Title is private"
data-url="Automattic/mongoose#15301"
data-hovercard-type="issue"
data-hovercard-url="/Automattic/mongoose/issues/15301/hovercard"
href="https://redirect.github.com/Automattic/mongoose/issues/15301">#15301</a></li>
</ul>
      </li>
      <li>
<b>8.13.3</b> - <a
href="https://redirect.github.com/Automattic/mongoose/releases/tag/8.13.3">2025-04-24</a></br><h1>8.13.3
/ 2025-04-24</h1>
<ul>
<li>fix: export MongooseBulkSaveIncompleteError <a class="issue-link
js-issue-link" data-error-text="Failed to load title"
data-id="3018324222" data-permission-text="Title is private"
data-url="Automattic/mongoose#15370"
data-hovercard-type="pull_request"
data-hovercard-url="/Automattic/mongoose/pull/15370/hovercard"
href="https://redirect.github.com/Automattic/mongoose/pull/15370">#15370</a>
<a class="issue-link js-issue-link" data-error-text="Failed to load
title" data-id="3016503732" data-permission-text="Title is private"
data-url="Automattic/mongoose#15369"
data-hovercard-type="issue"
data-hovercard-url="/Automattic/mongoose/issues/15369/hovercard"
href="https://redirect.github.com/Automattic/mongoose/issues/15369">#15369</a></li>
<li>fix: clone POJOs and arrays when casting query filter to avoid
mutating objects <a class="issue-link js-issue-link"
data-error-text="Failed to load title" data-id="3011345200"
data-permission-text="Title is private"
data-url="Automattic/mongoose#15367"
data-hovercard-type="pull_request"
data-hovercard-url="/Automattic/mongoose/pull/15367/hovercard"
href="https://redirect.github.com/Automattic/mongoose/pull/15367">#15367</a>
<a class="issue-link js-issue-link" data-error-text="Failed to load
title" data-id="3008658821" data-permission-text="Title is private"
data-url="Automattic/mongoose#15364"
data-hovercard-type="issue"
data-hovercard-url="/Automattic/mongoose/issues/15364/hovercard"
href="https://redirect.github.com/Automattic/mongoose/issues/15364">#15364</a></li>
<li>types(connection): add Connection.prototype.bulkWrite() to types <a
class="issue-link js-issue-link" data-error-text="Failed to load title"
data-id="3011492862" data-permission-text="Title is private"
data-url="Automattic/mongoose#15368"
data-hovercard-type="pull_request"
data-hovercard-url="/Automattic/mongoose/pull/15368/hovercard"
href="https://redirect.github.com/Automattic/mongoose/pull/15368">#15368</a>
<a class="issue-link js-issue-link" data-error-text="Failed to load
title" data-id="3001950341" data-permission-text="Title is private"
data-url="Automattic/mongoose#15359"
data-hovercard-type="issue"
data-hovercard-url="/Automattic/mongoose/issues/15359/hovercard"
href="https://redirect.github.com/Automattic/mongoose/issues/15359">#15359</a></li>
<li>docs: add version requirements to v7 migration docs <a
class="issue-link js-issue-link" data-error-text="Failed to load title"
data-id="3004536206" data-permission-text="Title is private"
data-url="Automattic/mongoose#15361"
data-hovercard-type="pull_request"
data-hovercard-url="/Automattic/mongoose/pull/15361/hovercard"
href="https://redirect.github.com/Automattic/mongoose/pull/15361">#15361</a>
<a href="https://redirect.github.com/SethFalco">SethFalco</a></li>
<li>docs: update links in deleteOne &amp; deleteMany API def <a
class="issue-link js-issue-link" data-error-text="Failed to load title"
data-id="3002799852" data-permission-text="Title is private"
data-url="Automattic/mongoose#15360"
data-hovercard-type="pull_request"
data-hovercard-url="/Automattic/mongoose/pull/15360/hovercard"
href="https://redirect.github.com/Automattic/mongoose/pull/15360">#15360</a>
<a href="https://redirect.github.com/Elliot67">Elliot67</a></li>
<li>docs: adds Model#count to list of fns callback removed from <a
class="issue-link js-issue-link" data-error-text="Failed to load title"
data-id="2984680663" data-permission-text="Title is private"
data-url="Automattic/mongoose#15349"
data-hovercard-type="pull_request"
data-hovercard-url="/Automattic/mongoose/pull/15349/hovercard"
href="https://redirect.github.com/Automattic/mongoose/pull/15349">#15349</a>
<a href="https://redirect.github.com/SethFalco">SethFalco</a></li>
</ul>
      </li>
      <li>
<b>8.13.2</b> - <a
href="https://redirect.github.com/Automattic/mongoose/releases/tag/8.13.2">2025-04-03</a></br><h1>8.13.2
/ 2025-04-03</h1>
<ul>
<li>fix: avoid double calling validators on paths in document arrays
underneath subdocuments <a class="issue-link js-issue-link"
data-error-text="Failed to load title" data-id="2964589348"
data-permission-text="Title is private"
data-url="Automattic/mongoose#15338"
data-hovercard-type="pull_request"
data-hovercard-url="/Automattic/mongoose/pull/15338/hovercard"
href="https://redirect.github.com/Automattic/mongoose/pull/15338">#15338</a>
<a class="issue-link js-issue-link" data-error-text="Failed to load
title" data-id="2962842706" data-permission-text="Title is private"
data-url="Automattic/mongoose#15335"
data-hovercard-type="issue"
data-hovercard-url="/Automattic/mongoose/issues/15335/hovercard"
href="https://redirect.github.com/Automattic/mongoose/issues/15335">#15335</a></li>
</ul>
      </li>
      <li>
<b>8.13.1</b> - <a
href="https://redirect.github.com/Automattic/mongoose/releases/tag/8.13.1">2025-03-28</a></br><h1>8.13.1
/ 2025-03-28</h1>
<ul>
<li>fix(populate): handle virtual populate on array of UUIDs <a
class="issue-link js-issue-link" data-error-text="Failed to load title"
data-id="2950829127" data-permission-text="Title is private"
data-url="Automattic/mongoose#15329"
data-hovercard-type="pull_request"
data-hovercard-url="/Automattic/mongoose/pull/15329/hovercard"
href="https://redirect.github.com/Automattic/mongoose/pull/15329">#15329</a>
<a class="issue-link js-issue-link" data-error-text="Failed to load
title" data-id="2920867131" data-permission-text="Title is private"
data-url="Automattic/mongoose#15315"
data-hovercard-type="issue"
data-hovercard-url="/Automattic/mongoose/issues/15315/hovercard"
href="https://redirect.github.com/Automattic/mongoose/issues/15315">#15315</a></li>
<li>types: allow default function returning undefined with DocType
override <a class="issue-link js-issue-link" data-error-text="Failed to
load title" data-id="2947550615" data-permission-text="Title is private"
data-url="Automattic/mongoose#15328"
data-hovercard-type="pull_request"
data-hovercard-url="/Automattic/mongoose/pull/15328/hovercard"
href="https://redirect.github.com/Automattic/mongoose/pull/15328">#15328</a></li>
</ul>
      </li>
      <li>
<b>8.13.0</b> - <a
href="https://redirect.github.com/Automattic/mongoose/releases/tag/8.13.0">2025-03-24</a></br><h1>8.13.0
/ 2025-03-24</h1>
<ul>
<li>feat: bump mongodb driver -&gt; 6.15.0</li>
<li>feat: support custom types exported from driver <a class="issue-link
js-issue-link" data-error-text="Failed to load title"
data-id="2932613125" data-permission-text="Title is private"
data-url="Automattic/mongoose#15321"
data-hovercard-type="issue"
data-hovercard-url="/Automattic/mongoose/issues/15321/hovercard"
href="https://redirect.github.com/Automattic/mongoose/issues/15321">#15321</a></li>
</ul>
      </li>
      <li>
        <b>8.12.2</b> - 2025-03-21
      </li>
      <li>
        <b>8.12.1</b> - 2025-03-04
      </li>
    </ul>
from <a
href="https://redirect.github.com/Automattic/mongoose/releases">mongoose
GitHub release notes</a>
  </details>
</details>

---

> [!IMPORTANT]
>
> - Check the changes in this PR to ensure they won't cause issues with
your project.
> - This PR was automatically created by Snyk using the credentials of a
real user.

---

**Note:** _You are seeing this because you or someone else with access
to this repository has authorized Snyk to open upgrade PRs._

**For more information:** <img
src="https://api.segment.io/v1/pixel/track?data=eyJ3cml0ZUtleSI6InJyWmxZcEdHY2RyTHZsb0lYd0dUcVg4WkFRTnNCOUEwIiwiYW5vbnltb3VzSWQiOiIyMjEyNTFhNy1lOGJhLTQyZjYtOGU0My01MzllOGU3NjRhYTciLCJldmVudCI6IlBSIHZpZXdlZCIsInByb3BlcnRpZXMiOnsicHJJZCI6IjIyMTI1MWE3LWU4YmEtNDJmNi04ZTQzLTUzOWU4ZTc2NGFhNyJ9fQ=="
width="0" height="0"/>

> - 🧐 [View latest project
report](https://app.snyk.io/org/kdsdesign1/project/6dfd2c96-abbb-46a3-be3c-7747489f415d?utm_source&#x3D;github&amp;utm_medium&#x3D;referral&amp;page&#x3D;upgrade-pr)
> - 📜 [Customise PR
templates](https://docs.snyk.io/scan-using-snyk/pull-requests/snyk-fix-pull-or-merge-requests/customize-pr-templates?utm_source=&utm_content=fix-pr-template)
> - 🛠 [Adjust upgrade PR
settings](https://app.snyk.io/org/kdsdesign1/project/6dfd2c96-abbb-46a3-be3c-7747489f415d/settings/integration?utm_source&#x3D;github&amp;utm_medium&#x3D;referral&amp;page&#x3D;upgrade-pr)
> - 🔕 [Ignore this dependency or unsubscribe from future upgrade
PRs](https://app.snyk.io/org/kdsdesign1/project/6dfd2c96-abbb-46a3-be3c-7747489f415d/settings/integration?pkg&#x3D;mongoose&amp;utm_source&#x3D;github&amp;utm_medium&#x3D;referral&amp;page&#x3D;upgrade-pr#auto-dep-upgrades)

[//]: #
'snyk:metadata:{"customTemplate":{"variablesUsed":[],"fieldsUsed":[]},"dependencies":[{"name":"mongoose","from":"8.12.1","to":"8.14.1"}],"env":"prod","hasFixes":false,"isBreakingChange":false,"isMajorUpgrade":false,"issuesToFix":[],"prId":"221251a7-e8ba-42f6-8e43-539e8e764aa7","prPublicId":"221251a7-e8ba-42f6-8e43-539e8e764aa7","packageManager":"npm","priorityScoreList":[],"projectPublicId":"6dfd2c96-abbb-46a3-be3c-7747489f415d","projectUrl":"https://app.snyk.io/org/kdsdesign1/project/6dfd2c96-abbb-46a3-be3c-7747489f415d?utm_source=github&utm_medium=referral&page=upgrade-pr","prType":"upgrade","templateFieldSources":{"branchName":"default","commitMessage":"default","description":"default","title":"default"},"templateVariants":[],"type":"auto","upgrade":[],"upgradeInfo":{"versionsDiff":7,"publishedDate":"2025-04-29T21:44:37.328Z"},"vulns":[]}'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants