driver-core/src/main/com/mongodb/client/model/Filters.java
public static Bson exists(final String fieldName, final boolean exists) {
        return new OperatorFilter<BsonBoolean>("$exists", fieldName, BsonBoolean.valueOf(exists));
    }
public static Bson exists(final String fieldName, final boolean exists) {
        return new OperatorFilter<BsonBoolean>("$exists", fieldName, BsonBoolean.valueOf(exists));
    }
public static Bson exists ( final String fieldName , final boolean exists ) { return new OperatorFilter < BsonBoolean > ( "$exists" , fieldName , BsonBoolean . valueOf ( exists ) ) ; }
Creates a filter that matches all documents that either contain or do not contain the given field, depending on the value of the
exists parameter.

@param fieldName the field name
@param exists    true to check for existence, false to check for absence
@return the filter
@mongodb.driver.manual reference/operator/query/exists $exists
Creates a filter that matches all documents that either contain or do not contain the given field depending on the value of the exists parameter .