Query for Bloom Filter

Hello everyone, for our new project we decided to use mongo, one of the requirements is to exclude certain documents, of which there can be tens of thousands, for this we decided to use bloom filters. I see that mongo supports operators like bitsAllSet that we can use to exclude data from the selection if it stores bloom filters in the document in binary form, but judging by how the queries are built, we can only make a pass through bloom filters in other documents, which will lead to updating all filters after the selection

db.collection.find({
    bloomFilter: {
        $bitsAllSet: [
            <document_id_in_index_hash>,
        ]
    }
})

Is it possible to somehow compose a query so that we try to find document_id_in_index_hash only in one bloom filter (which we are interested in) and get the document_id_in_index_hash array that is in this filter

Hey… welcome to the community. So glad you’ve chosen MongoDB for your project. If your Bloom filters are stored in individual documents and you want to query a specific filter… you need to identify the document uniquely. For example, if each Bloom filter is associated with a unique filterId, you can use the following query:

db.collection.find({
    filterId: "specific_filter_id", // Identify the specific document
    bloomFilter: {
        $bitsAllSet: [<bit_positions>] // Check if bits are set
    }
});
``
Let us know how you make out.