'Need to get aggregation filters result for notequals, equals, contains, not contains, starts with and ends with

I have a method which returns filtered result.

 private Bson filter() {       
       return Aggregates.match(Filters.eq("product","abc"));
    }

The above code returns results where product is equal to abc. Similarly I need to do get results for not equals, contains, not contains, starts with, ends with. Can someone help on this?



Solution 1:[1]

There are tons of public methods you could use for this, have a look at the Javadoc here https://mongodb.github.io/mongo-java-driver/3.6/javadoc/com/mongodb/client/model/Filters.html

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 zabdulz