I have the following aggregation pipeline:
val sources = Seq("1.1.1.1", "6.6.6.6")
val fileTypes = Seq("docx")
val files = DB.fileRead.aggregate(Seq(
Aggregates.filter(Filters.and(
Filters.in("source", sources: _*),
Filters.in("fileType", fileTypes: _*),
))
))
If the sources
or fileType
sequence is empty, how to construct a query to ignore its filter respectively such as, Filters.in("source", sources: _*)
or Filters.in("fileType", fileTypes: _*)
? I don't want to use Filters.or()
since I want a result that produced by both filters in Filters.and()
.