the line for doc in collection.find({'is_timeline_valid': True}):
is giving the Message Length error. How can I get all the collection without the error? I know about the find().limit()
but I don't know how to use it.
Code:
from openpyxl import load_workbook
import pymongo
import os
wb = load_workbook('concilia.xlsx')
ws = wb.active
client = pymongo.MongoClient('...')
db = client['...']
collection = db['...']
r = 2
for doc in collection.find({'is_timeline_valid': True}):
for dic in doc['timeline']['datas']:
if 'concilia' in dic['tramite'].lower():
ws.cell(row = r, column = 1).value = doc['id_process_unformatted']
ws.cell(row = r, column = 2).value = dic['data']
ws.cell(row = r, column = 3).value = dic['tramite']
wb.save('concilia.xlsx')
print('*****************************')
print(dic['tramite'])
# print('check!')
r += 1