DBObject dbObject = new BasicDBObject();
//dbObject.put("name", "zhangsan"); //查询条件
BasicDBObject fieldsObject=new BasicDBObject();
//指定返回的字段
fieldsObject.put("name", true);
fieldsObject.put("age", true);
fieldsObject.put("sex", true);
Query query = new BasicQuery(dbObject,fieldsObject);
List<Person> user = mongoTemplate.find(query, Person.class);