Reputation: 61
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
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.
npm uninstall mongoose
npm install [email protected] --save-exact
.createConnection
instead.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