简体   繁体   中英

Error: insertOne()` buffering timed out after 10000ms

I am at the very beginning of learning Mongoose, and I am having trouble saving this model to my database and keep getting an error: insertOne()` buffering timed out after 10000ms

This is my code:

代码

How can I find a solution for this?

 const options = { autoIndex: false, // Don't build indexes maxPoolSize: 10, // Maintain up to 10 socket connections serverSelectionTimeoutMS: 5000, // Keep trying to send operations for 5 seconds socketTimeoutMS: 45000, // Close sockets after 45 seconds of inactivity family: 4 // Use IPv4, skip trying IPv6 }; mongoose.connect(uri, options);

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