Argumen kedua dari metode find adalah tipe hasil. Coba seperti di bawah ini.
FindIterable<TDocType> tDocTypeList = dbCollection.find(filter, TDocType.class);
Pembaruan untuk proyeksi
FindIterable<TDocType> tDocTypeList = dbCollection.find(filter, TDocType.class).projection(outputQuery);
Perbarui untuk menambahkan filter
List<Bson> filters = new ArrayList<>();
for (Map.Entry<String, Object> entry : query.getParams().entrySet()) {
// this is where its building the query
if (some condition){
filters.add(Filters.eq(entry.getKey(), entry.getValue()));
}
if (some other condition){
filters.add(Filters.in(entry.getKey(), query.getValues()));
}
}
FindIterable<TDocType> docType = dbCollection.find(Filters.and(filters));