Error when assigning date in utc format to a field in mongodb from python code
In my python code i have the following line which stores the current date in UTC format in a field in a mongodb database:
s['metadata']['some_date'] = datetime.utcnow()
But on running the program, i get the following error :
TypeError:开发者_开发问答 'unicode' object does not support item assignment
What is the wrong with my code and how to fix it ?
Please Help Thank You
Either 's' or s['metadata'] is a string but not a dict....pdb is your friend.
精彩评论