def get_next_id(self):
        try:
            query = {'_id': 'last_id'}
            update = {'$inc': {'id': 1}}
            fn = self.db.internal.find_and_modify
            row = fn(query, update, upsert=True, new=True)
        except Exception as e:
            raise DatabaseException(e)
        return row['id']
def values(cls, dataset, dim, expanded=True, flat=True, compute=True,
               keep_index=False):
        dim = dataset.get_dimension(dim, strict=True)
        data = dataset.data[dim.name]
        if not expanded:
            data = data.unique()
            return data.values_host if compute else data.values
        elif keep_index:
            return data
        elif compute:
            return data.values_host
        try:
            return data.values
        except Exception:
            return data.values_host