MongooseError:操作 `shorturls.insertOne()` 缓冲在 10000 毫秒后超时?

我已经检查了所有这些东西:-

  • IP 白名单
  • 异步函数 try catch
  • 帐号密码
  • Nodejs 版本

现在我仍然收到错误

Mongo 连接代码

  const connectDB = async() =>{
    await mongoose.createConnection(URI,{
        useNewUrlParser: true,useUnifiedTopology: true,useCreateIndex: true,})   
 .then(() => console.log("Database connected!"))
 .catch(err => console.log(err));
    }

发布请求

app.post('/shorturl',async (req,res)=>{
  let shortUrl = new shorturl({full:req.body.fullurl})
  console.log("Saving!!")
   await shortUrl.save()
    
   .then(()=>{ console.log("Inserted!!"); res.send(shortUrl.short)}).catch(error => console.log("ERROR"));
  //await shorturl.create({full:req.body.fullurl}) 
  //  if(shortUrl == null )return res.sendStatus(404);
    
})
tym520 回答:MongooseError:操作 `shorturls.insertOne()` 缓冲在 10000 毫秒后超时?

暂时没有好的解决方案,如果你有好的解决方案,请发邮件至:iooj@foxmail.com
本文链接:https://www.f2er.com/8423.html

大家都在问