我正在为我的软件编写一个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'
分.
这个函数只是用来查找recid与参数匹配的文档,并更新其creation_date字段.
为什么会发生这种错误?