0
我想創建一個使用mongoTemplate進行日誌記錄的封頂集合。但是,我的收藏數量正在超出我作爲參數傳遞的大小。任何人都可以請幫忙。使用MongoDB和SpringData封頂的集合
public synchronized MongoTemplate getTemplate() {
if (template == null) {
Mongo mongo = null;
mongo = new Mongo(addrs);
template = new MongoTemplate(mongo, this.dbName);
if(!template.collectionExists(HttpRequestEntity.class)){
CollectionOptions options = new CollectionOptions(4,4,true);
template.createCollection(HttpRequestEntity.class, options);
}
}
return template;
}
爲了節省我打電話保存此模板實例
getTemplate().save(entity);