Mongoose Error: "useCreateIndex" is not supported but documentation still has it

Jane B.

This is frustrating. No clues why I got this error while documentation still has it. Please help!

My code to connect MongoDB with mongoose.

const mongoose = require('mongoose');

const connectDB = async () => {
    try {
        const conn = await mongoose.connect(process.env.MONGO_URI, {
            useNewUrlParser: true,
            useCreateIndex: true,
            useUnifiedTopology: true
        });

        console.log(`MongoDB Connected: ${conn.connection.host}`.cyan.underline.bold);
    } catch (err) {
        console.log(`Error: ${err.message}`.red);
        process.exit(1);
    }

}

module.exports = connectDB;

Error: option usecreateindex is not supported

Documentation says useCreateIndex is the updated method.

https://mongoosejs.com/docs/deprecations.html#

Ally Ally

to me, I just remove useCreateIndex

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

mongoose's documentation example for population, gives an error

How to check if Flash Player version is still supported and has recent updates?

i did all the instruction on the documentation but i still get this error

Mongoose.create is adding to database but is still catching an error

Is KubeFlow still supported on GCP?

Is Wubi still supported?

dsa still supported for ssh?

iOS Error: Supported orientations has no common orientation with the application (iPhone)

is it a mongoose documentation population typos?

A trait with a Sized supertrait still has the error "std::marker::Sized is not satisfied"

pandas read_json in chunks but still has memory error

Object reference not set to an instancet - variable has value still error is coming

Why is there still CORS error if response has allow origin set to all?

`jekyll build` has error but gitlab ci still continues

Still getting "stream has already been operated upon or closed" error

still get error on has been blocked by CORS policy

Is Jaxen still actively supported/developed?

Is iptables string matching still supported?

Is OpenJDK6 still supported?

Is firewire still supported by Ubuntu 19.10?

Error 'Object has no method xxx ' while using Mongoose

Error: mongoose-auto-increment has not been initialized

Code has no error and logcat has nothing, but still unfortunately app stopped error

$push is not supported in mongoose bulk operation

Does collection still exists in mongoose?

Scalatest maven plugin: ERROR: -c has been deprecated for a very long time and is no longer supported

Azure DevOps API error: Field state 'Active' not supported when Work Item has been "Removed"

Tried Everything but still this error occur - A network error (such as timeout, interrupted connection or unreachable host) has occurred

Getting an SSL error for the java client library that I'm writting in Java. Requests still fail after following documentation