我正在为我的软件编写一个 API,以便更容易访问 mongodb。
我有这条线:
def update(self, recid):
self.collection.find_and_modify(query={"recid":recid}, update={{ "$set": {"creation_date":str( datetime.now() ) }}} )
哪个抛出TypeError: Unhashable type: 'dict'
。
这个函数只是为了找到与参数匹配的文档并更新它的 creation_date 字段。
为什么会出现这个错误?