FG
🗄️ DatabasesMongoDB

DeprecationWarning: collection.ensureIndex is deprecated. Use createIndexes instead.

Freshover 7 years ago
Mar 14, 20260 views
Confidence Score75%
75%

Problem

After update to version `5.2.9` I'm getting this message in console all the time, when I start my web app: `DeprecationWarning: collection.ensureIndex is deprecated. Use createIndexes instead.` And I don't use neither of them.

Unverified for your environment

Select your OS to check compatibility.

1 Fix

Canonical Fix
High Confidence Fix
74% confidence92% success rate9 verificationsLast verified Mar 14, 2026

Solution: DeprecationWarning: collection.ensureIndex is deprecated. Use createIndexes instead.

Low Risk

After upgrading to version 5.2.10. Any of the options below should stop the warnings? [code block]` or [code block]` It didnt work here. (Sorry if I did something wrong)

74

Trust Score

9 verifications

92% success
  1. 1

    After upgrading to version 5.2.10. Any of the options below should stop the warn

    After upgrading to version 5.2.10. Any of the options below should stop the warnings?

  2. 2

    [code block]`

    or [code block]` It didnt work here. (Sorry if I did something wrong)

Validation

Resolved in Automattic/mongoose GitHub issue #6890. Community reactions: 126 upvotes.

Verification Summary

Worked: 9
Partial: 2
Failed: 1
Last verified Mar 14, 2026

Sign in to verify this fix

Environment

Submitted by

AC

Alex Chen

2450 rep

Tags

mongoosemongodbodmenhancement