data = [item for item in collection.find(
{"code": {"$in": code}}, batch_size=10000)]
else:
data = [item for item in collection.find()]
if len(data) > 0:
res_pd = pd.DataFrame(data)
After Change
data = [item for item in collection.find(
{"code": {"$in": code}}, {"_id": 0}, batch_size=10000)]
else:
data = [item for item in collection.find({}, {"_id": 0})]
if len(data) > 0:
res_pd = pd.DataFrame(data)