List of usage examples for org.springframework.data.mongodb.core.query BasicQuery limit
public Query limit(int limit)
From source file:com.card.loop.xyz.dao.LearningElementDAO.java
public List<LearningElement> searchLE(String keyword) { //return mongoOps.findAll(LearningElement.class); //Query query = new Query(); BasicQuery query = new BasicQuery("{\"title\": {$regex : '/" + keyword + "/'} }"); // System.out.println(query+"HAHA"); query.limit(10); //query.addCriteria(where("title").is(keyword).orOperator(where("subject").is(keyword)).orOperator(where("description").is(keyword))); //query.addCriteria(Criteria.where("title").regex(keyword)); System.out.println(query);/*from w w w.j a v a 2 s .c o m*/ //return mongoOps.find(query(where("title").regex(keyword)), LearningElement.class); return mongoOps.find(query(where("status").is(1)), LearningElement.class); }