'This function uses a MongoDB backup file as a source to feed the
passive table.'

def migrate_from_mongodb_backup(self, backupfdesc):

    def _backupgen(fdesc):
        for line in fdesc:
            try:
                line = line.decode()
            except AttributeError:
                pass
            try:
                line = json.loads(line)
            except ValueError:
                utils.LOGGER.warning('ignoring    line    [%r]', line)
                continue
            try:
                del line['_id']
            except KeyError:
                pass
            line.update(line.pop('infos', {}))
            line.update(line.pop('fullinfos', {}))
            for (key, value) in viewitems(line):
                if (isinstance(value, dict) and (len(value) == 1) and ('$numberLong' in value)):
                    line[key] = int(value['$numberLong'])
            (yield line)
    self.insert_or_update_bulk(_backupgen(backupfdesc), getinfos=None, separated_timestamps=False)
