I have a collection in MongoDB with 4,040,989 records. I am fetching and saving it in a csv in following way-
import pandas as pd
import pymongo
connection_string=''
myclient = pymongo.MongoClient(connection_string)
mydb = myclient[""]
mycol = mydb[""]
x = mycol.find()
df = pd.DataFrame(list(x))
print(df)
df.to_csv('Db_collection.csv')
The above way is taking so much time (it has been 30 minutes still continues) for this task.
Is there any inbuilt or custom efficient way to complete this process faster with Python?
I am using Python 3.7, PyMongo 3.10.1 and Windows 10 with GPU.