(old_value, new_value, changed_field)
return message
Handles the processing of changed fields where the changed field
        is a list of items. Displays the changed value in json format via to_json().

        :type old_value: The old mongo object to compare values against.
        :param old_value: A Mongo Document
        :type new_value: The updated/new mongo object to compare values against.
        :param new_value: A Mongo Document
        :type changed_field: The field name that the comparisons will be against.
        :param changed_field: str
        :returns: str: Returns a message summarizing the changes.
Handles the processing of changed fields where the changed field
        is a list of items. Displays the changed value in json format via to_json().
Handles the processing of changed fields where the changed field is a list of items . Displays the changed value in json format via to_json () .
def generic_list_json_change_handler(old_value, new_value, changed_field):
        """
        Handles the processing of changed fields where the changed field
        is a list of items. Displays the changed value in json format via to_json().

        :type old_value: The old mongo object to compare values against.
        :param old_value: A Mongo Document
        :type new_value: The updated/new mongo object to compare values against.
        :param new_value: A Mongo Document
        :type changed_field: The field name that the comparisons will be against.
        :param changed_field: str
        :returns: str: Returns a message summarizing the changes.
        """

        removed_names = [x.to_json() for x in old_value if x not in new_value and x != '']
        added_names = [x.to_json() for x in new_value if x not in old_value and x != '']

        message = ""
        if len(added_names) > 0:
            added_names = ', '.join(added_names)
            if not isinstance(added_names, unicode):
                added_names = unicode(added_names, 'utf-8', 'replace')
            message += "Added to %s: %s. " % (changed_field, added_names)
        if len(removed_names) > 0:
            removed_names = ', '.join(removed_names)
            if not isinstance(removed_names, unicode):
                removed_names = unicode(removed_names, 'utf-8', 'replace')
            message += "Removed from %s: %s. " % (changed_field, removed_names)

        return message
def generic_list_json_change_handler ( old_value , new_value , changed_field ) : removed_names = [ x . to_json ( ) for x in old_value if x not in new_value and x != '' ] added_names = [ x . to_json ( ) for x in new_value if x not in old_value and x != '' ] message = "" if len ( added_names ) > 0 : added_names = ', ' . join ( added_names ) if not isinstance ( added_names , unicode ) : added_names = unicode ( added_names , 'utf-8' , 'replace' ) message += "Added to %s: %s. " % ( changed_field , added_names ) if len ( removed_names ) > 0 : removed_names = ', ' . join ( removed_names ) if not isinstance ( removed_names , unicode ) : removed_names = unicode ( removed_names , 'utf-8' , 'replace' ) message += "Removed from %s: %s. " % ( changed_field , removed_names ) return message