List of usage examples for org.springframework.data.mongodb.core MongoOperations findAll
<T> List<T> findAll(Class<T> entityClass, String collectionName);
From source file:com.mycompany.model.MongoDBTest.java
public List<Marker> getMarker() { ApplicationContext ctx = new AnnotationConfigApplicationContext(MongoConfig.class); MongoOperations mongoOperation = (MongoOperations) ctx.getBean("mongoTemplate"); DBCollection markerCollection = mongoOperation.getCollection("markers"); DBCursor result = markerCollection.find(); while (result.hasNext()) { DBObject tobj = result.next();//from w w w. j a va 2 s. c o m //System.out.println(tobj.get("_id")); } List<Marker> listUser = mongoOperation.findAll(Marker.class, "markers"); return listUser; }