Det andet argument for find-metoden er resultattype. Prøv som nedenfor.
FindIterable<TDocType> tDocTypeList = dbCollection.find(filter, TDocType.class);
Opdatering til projektion
FindIterable<TDocType> tDocTypeList = dbCollection.find(filter, TDocType.class).projection(outputQuery);
Opdatering for tilføjelse af filtre
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));