MongooseError: Operation `details.insertOne()` buffering timed out after 10000ms

Hi All,

I just started to learn mongoDB and node js.

I am facing a issue during learning the first time setup with nodejs and mongoDB.

onst err = new MongooseError(message);
^

MongooseError: Operation details.insertOne() buffering timed out after 10000ms

this is my app.js file data with that i am getting this error.

const { request, response } = require('express')
const express = require('express');
const hbs = require('hbs');
const app = express();
const mongoose = require("mongoose");

const routes = require('./routes/main');
const Detail = require('./models/Detail');

// /static/css/style.css
app.use('/static', express.static("public"))
// app.use(express.static("public"))


app.use('', routes)

// Template Engine HBS 
app.set('view engine', 'hbs')
// this is the path where our all HTML files are available
app.set('views', 'views')
hbs.registerPartials('views/partials')



// MogoDB Connections
mongoose.set("strictQuery", false);
mongoose.connect("mongodb://localhost/nodejslearning", () => {
    console.log("database connected") 
    Detail.create(
        {
            brandName:"Learn NodeJS",
            brandIconUrl:"/",
            links:[
                {
                    label:"Home",
                    url:"/",
                },
                {
                    label:"Services",
                    url:"/",
                },
                
            ]
        }
    )
})

 
app.get('/', (request, response) => {
    response.send("Wow This is the data from our server")
})

app.listen(process.env.PORT | 1111, () => {
    console.log('our website server is running now')
})


after updating 127.0.0.1 in place of localhost this problem is resolved for me.

1 Like

This topic was automatically closed 5 days after the last reply. New replies are no longer allowed.