简体   繁体   中英

Mongoose error const err = new MongooseError(message); - buffering timed out

I am trying to use node.js with MongoDB using Mongoose, but damn I am stuck in the same error for last week, it keeps giving the same error:

在此处输入图像描述

const mongoose = require("mongoose");
mongoose.set('strictQuery', true);
mongoose.connect("mongodb://localhost:27017/newDB", { useNewUrlParser: true ,  useUnifiedTopology: true 
 });

console.log("Connected")


//SCHEMA

const DBSchema = new mongoose.Schema ({name : String,anything : String})


const DaB= mongoose.model("Working",DBSchema)


const db=new DaB({name:"user",anything:"Some text"})

db.save();

I have tried various ways to fix it,but it isnt fixing

Don't use localhost, use 127.0.0.1.(Source - @robertklep)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM