Обновить MongoDB значением из DF ⇐ Python

Программы на Python
Anonymous
Обновить MongoDB значением из DF

Сообщение Anonymous »

У меня есть следующий пример фрейма данных:

Код: Выделить всё

   request            new_request
0  Whats the time     What's the time?
1  its late           it's late!
Тогда у меня есть следующая коллекция mongodb:

Код: Выделить всё

{
'_id': 'b5445',
'request': 'Whats the time',
'accepted': True,
'aId': '6954c4',
'createDate': '1610726929114'
}
{
'_id': '4534fg', ,
'request': 'its late',
'accepted': True,
'aId': 'a86dfsb',
'createDate': '1610964941537'
}
Я хочу обновить коллекцию mongoDB, чтобы она выглядела так:

Код: Выделить всё

{
'_id': 'b5445',
'request': "What's the time?",
'accepted': True,
'aId': '6954c4',
'createDate': '1610726929114'
}
{
'_id': '4534fg',
'request': "it's late!",
'accepted': True,
'aId': 'a86dfsb',
'createDate': '1610964941537'
}
Я новичок в mongoDB, поэтому полностью застрял. Как мне это сделать?

Подробнее здесь: https://stackoverflow.com/questions/657 ... ue-from-df

Вернуться в «Python»