Выводы :

Консоль producer :

Введите сообщение или END для завершение:
{'message' : 'hello', 'name' : 'Ivan'}
[P] Sent '{'message' : 'hello', 'name' : 'Ivan'}'

Process finished with exit code 0

Консоль consumer

 [PK] Waiting for messages. To exit press CTRL+C
 [PK] Received message : {'message' : 'hello', 'name' : 'Ivan'}
[DB] Message sent under the number 6258b3e32c8403a75714b2e5
[DB] Message found in the database

MongoDB Compass console

> use SeriesDB

< 'switched to db SeriesDB'

> db.series.find({})

< { _id: ObjectId("6258b3e32c8403a75714b2e5"),
  message: '{\'message\' : \'hello\', \'name\' : \'Ivan\'}',
  date: '2022-04-15',
  time: '2:53:7' }

Гайд по MongoDB

https://dev-gang.ru/article/integracija-mongodb-s-python-s-ispolzovaniem-pymongo-9hmv4a77cw/