def all_query(expression):
    """Match arrays that contain all elements in the query."""
    def _all(index, expression=expression):
        """Return store key for documents that satisfy expression."""
        ev = expression() if callable(expression) else expression
        try:
            iter(ev)
        except __HOLE__:
            raise AttributeError('$all argument must be an iterable!')

        hashed_ev = [index.get_hash_for(v) for v in ev]
        store_keys = set([])

        if len(hashed_ev) == 0:
            return []
        store_keys = set(index.get_keys_for(hashed_ev[0]))
        for value in hashed_ev[1:]:
            store_keys &= set(index.get_keys_for(value))
        return list(store_keys)

    return _all
dataset/ETHPy150Open adewes/blitzdb/blitzdb/backends/file/queries.py/all_query