'Apply updates given in update_spec to the document whose id
matches that of doc.'

def update(self, document_id, update_spec, namespace, timestamp):

    document = self.doc_dict[document_id].doc
    updated = self.apply_update(document, update_spec)
    if ('_id' in updated):
        updated.pop('_id')
    updated[self.unique_key] = document_id
    self.upsert(updated, namespace, timestamp)
    return updated
