question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

products.deleteMany()` buffering timed out after 10000ms

See original GitHub issue

Hi i am trying to upload my products from my json file to the database. I am able to connect to the database however when i try to upload the products i am getting this error.

Error with data import MongooseError: Operation `products.deleteMany()` buffering timed out after 10000ms
    at Timeout.<anonymous> (C:\Users\nmajo\OneDrive\Desktop\Webapp2\node_modules\mongoose\lib\drivers\node-mongodb-native\collection.js:185:20)
    at listOnTimeout (internal/timers.js:549:17)
    at processTimers (internal/timers.js:492:7)
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! Webapp2@1.0.0 data:import: `node backend/DBScript.js`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the Webapp2@1.0.0 data:import script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     C:\Users\nmajo\AppData\Roaming\npm-cache\_logs\2021-01-21T23_53_15_306Z-debug.log

This is the code i am using.

require("dotenv").config();
const productData = require("./data/products");
const connectDB = require("./config/database");
const Product = require("./models/Products");

 connectDB();

const importData = async () => {
  try {
    await Product.deleteMany({});

    await Product.insertMany(productData);

    console.log("Data Import Success");

    process.exit();
  } catch (error) {
    console.error("Error with data import", error);
    process.exit(1);
  }
};
importData();

When i remove the await on the Product.deleteMany and the Insert many, its saying products have been uploaded, however when i check the mongo db, there are no products. Does anyone have an idea on how i can fix this ?

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:6

github_iconTop GitHub Comments

2reactions
TerraAtgithubcommented, Feb 10, 2021

Hi I also have a similar issue and nothing has worked for me so far (users.findOne in my case). One thing that I noticed is that when I search “buffering timed out after 10000ms” in stackoverflow pretty much all of the problems with the above phrasing came from December 2020 and January 2021 (also Feb 2021). So perhaps this is a mongoose problem caused by an update within that time period?

1reaction
leungk712commented, Feb 10, 2021

Seconded w/ @TerraAtgithub . I tried to deploy to Heroku many times yesterday but I kept encountering a buffering .find() 10000ms. Even when I’ve wrapped my mongoose.connect inside an async/await function I received a “Error: MongooseError: Cannot call posts.find() before initial connection is complete if bufferCommands = false. Make sure you await mongoose.connect() if you have bufferCommands = false.”

Have noticed few posts recently about the mongoose.connect buffering 10000ms issue within the past few months.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Operation `orders.deleteMany()` buffering timed out after ...
I don't know why showing buffering timed out . MongooseError: Operation `orders.deleteMany()` buffering timed out after 10000ms. seeder.js.
Read more >
How to Fix "Buffering timed out after 10000ms" Error in ...
The buffering timeout is usually due to either registering models on a newly created connection but using mongoose.connect() : const mongoose = ...
Read more >
MongooseError: Operation `users.insertOne()` buffering timed ...
MongooseError: Operation `users.insertOne()` buffering timed out after 10000ms ... I'm new to MERN stack. I built some MERN app where I didn't ...
Read more >
Operation `orders.deleteMany()` buffering timed out after ...
Coding example for the question MongooseError: Operation `orders.deleteMany()` buffering timed out after 10000ms-mongodb.
Read more >
Mongoose error : buffering timed out after 10000ms - YouTube
Mongoose error : buffering timed out after 10000ms. 3.5K views 6 months ago. Veera's CodeLab. Veera's CodeLab. 9 subscribers. Subscribe.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found