I have a method in my DAO which looks like this
ProductDao.java
public List<Document> getAllProducts() {
return mongoCollection.find().into(new ArrayList<Document>());
}
What I would like instead is
//return a list of Product instead of Document
public List<Product> getAllProducts() {
return mongoCollection.find().into(new ArrayList<Product>());
}
pom.xml
<dependency>
<groupId>org.mongodb</groupId>
<artifactId>mongo-java-driver</artifactId>
<version>3.3.0</version>
</dependency>
How can I achieve this?