According Database.update()
method realization and his documentation, first argument should be list of document objects (e.g. list of dicts). Since you doc
variable has dict type, direct iteration over it actually iterates over all his keys which are string typed. If I understood your case right, probably your doc
contains nested documents as values. So, try just:
db.update(doc.values(), all_or_nothing=True)
And it all first level values are dicts, it should works!