Gustavo Rodrigues
Gustavo Rodrigues

Reputation: 61

[Mongoose error]: conn.openUri(...).then is not a function

Hy guys, i am developing my application using mongodb and nodejs, but returns this error: conn.openUri(...).then is not a function

my connection:

const mongoose = require("mongoose")

mongoose.connect('url', {
    useNewUrlParser: true,
    useUnifiedTopology: true,
    useFindAndModify: false
})

mongoose version: v5.10.0

who can help please

Upvotes: 1

Views: 1135

Answers (1)

AdamExchange
AdamExchange

Reputation: 1299

This is a known issue with mongoose at v5.10.0

https://github.com/Automattic/mongoose/issues/9335

There are a few possible solutions.

  1. Recommended - install mongoose at the previous version. v5.9.29. If using npm you can npm uninstall mongoose npm install [email protected] --save-exact.
  2. You can connect using createConnection instead.

EDIT

By this time the issue has been fixed in version 5.10.1 of mongoose. so the best you can do is to upgrade mongoose to the latest version.

Upvotes: 5

Related Questions