package com.m2pool.manage.config;

import lombok.Data;
import org.springframework.data.mongodb.MongoDatabaseFactory;
import org.springframework.data.mongodb.core.MongoTemplate;
import org.springframework.data.mongodb.core.SimpleMongoClientDatabaseFactory;

/**
 * @Description TODO
 * @Date 2023/4/17 18:46
 * @Author 杜懿
 */
@Data
public abstract class AbstractMongoDbConfig {
    public MongoDatabaseFactory mongoDatabaseNoUserFactory(String host, String port, String database) {
        String connectionString = "mongodb://"+ host+":"+port +"/" + database;
        return new SimpleMongoClientDatabaseFactory(connectionString);
    }
    public abstract MongoTemplate getMongoTemplate();
}
