Skip to content
Advertisement

How to fix memory error while importing a very large csv file to mongodb in python?

Given below is the code for importing a pipe delimited csv file to monogdb.

JavaScript

Below is the error I get when running the above code.

JavaScript

I if modify the code with some indents under the for loop. The MongoDB gets imported with the same data all over again without stopping.

JavaScript

Advertisement

Answer

The memory issue can be solved by inserting one record at a time.

JavaScript

Thank You All for Your Ideas

User contributions licensed under: CC BY-SA
6 People found this is helpful
Advertisement