def apply_update(self, doc, update_spec):
<EOL>if not '<STR_LIT>' in update_spec and not '<STR_LIT>' in update_spec:<EOL><INDENT>update_spec['<STR_LIT>'] = doc[self.unique_key]<EOL>return update_spec<EOL><DEDENT>for to_set in update_spec.get("<STR_LIT>", []):<EOL><INDENT>value = update_spec['<STR_LIT>'][to_set]<EOL>keys_to_pop = []<EOL>for key in doc:<EOL><INDENT>if key.startswith(to_set):<EOL><INDENT>if key == to_set or key[len(to_set)] == '<STR_LIT:.>':<EOL><INDENT>keys_to_pop.append(key)<EOL><DEDENT><DEDENT><DEDENT>for key in keys_to_pop:<EOL><INDENT>doc.pop(key)<EOL><DEDENT>doc[to_set] = value<EOL><DEDENT>for to_unset in update_spec.get("<STR_LIT>", []):<EOL><INDENT>keys_to_pop = []<EOL>for key in doc:<EOL><INDENT>if key.startswith(to_unset):<EOL><INDENT>if key == to_unset or key[len(to_unset)] == '<STR_LIT:.>':<EOL><INDENT>keys_to_pop.append(key)<EOL><DEDENT><DEDENT><DEDENT>for key in keys_to_pop:<EOL><INDENT>doc.pop(key)<EOL><DEDENT><DEDENT>return doc<EOL>
Override DocManagerBase.apply_update to have flat documents.