记录一下Junit测试MongoDB,获取MongoTemplate
生活随笔
收集整理的這篇文章主要介紹了
记录一下Junit测试MongoDB,获取MongoTemplate
小編覺得挺不錯(cuò)的,現(xiàn)在分享給大家,幫大家做個(gè)參考.
只是自己記錄一下,測(cè)試MongoDB幫助類時(shí),沒有配置文件的測(cè)試
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是自己封裝的對(duì)查詢結(jié)果的處理轉(zhuǎn)載于:https://www.cnblogs.com/Cassie-wang/p/10142841.html
總結(jié)
以上是生活随笔為你收集整理的记录一下Junit测试MongoDB,获取MongoTemplate的全部?jī)?nèi)容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: C#图片按指定大小分割
- 下一篇: 如何在excel不同的工作表之间使用数据