Error Message from MongoDB "Operation `disneys.insertOne()` buffering timed out after 10000ms""
Also, your API call seem to have a problem, It should be disneyCharacters
instead of disneyCharacter
.
Also, probably setup a local database first instead of using process.env.DATABASE_URL
.
Actually i was also getting the same error.steps i performed to solve this error are
while creating database in mongodb
- allow access from anywhere (ip configuration)
- choose the nearest server
this solved my problems :)
In my application the same error message was thrown.The difference is, that I am using MongoDB Atlas, instead of a local MongoDB.
Solution:After added "+srv" to the URL scheme is issue was gone:
const mongoose = require("mongoose");mongoose.set('useUnifiedTopology', true);mongoose.set('useNewUrlParser', true);mongoose.connect("mongodb+srv://user:password@host/dbname").then( () => console.log("connected to DB.")).catch( err => console.log(err));
Dependencies in package.json:
"dependencies": {"mongoose": "^5.11.12",}
MongoDB Version 4.2.11
The connection string is given in the MongoDB Atlas frontend: -> Data Storage -> Cluster -> connect -> Connect your application
There you can find some code snippets.