Answer the question
In order to leave comments, you need to log in
How to update MongoDB document values using PyMongo?
Good time!
Let's say we added a document to the collection:
db.goalsdoc.insert_one({'chat_id': message.chat.id, 'goals': [{'theme': message.text, 'date': '', 'subgoals': []}]})
db.goalsdoc.update_one({'chat_id': message.chat.id}, {'$set': {'goals.date': message.text}})
db.goalsdoc.update_one({'chat_id': message.chat.id}, {'$push': {'goals.subgoals': message.text}})
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question