只是自己记录一下,测试MongoDB帮助类时,没有配置文件的测试
public class HelperTest {MongoTemplate template;@Beforepublic void init() {MongoDbFactory facotry = new SimpleMongoDbFactory(new MongoClient("127.1.1.1", 27017), "test");template = new MongoTemplate(facotry);}@Testpublic void test() {AggregationProxyResults<Document> results = MongodbQueryHelper.queryHotel("test", 1, template, Document.class, LocalDateTime.of(2018, 04, 11, 00, 00), LocalDateTime.of(2018, 04, 12, 00, 00));System.out.println(results.list());}
AggregationProxyResults是自己封装的对查询结果的处理