func NewMongoStore(config MongoConfig) (*MongoStore, error) {
	var session *mgo.Session
	if config.URL != "" {
		s, err := mgo.Dial(config.URL)
		if err != nil {
			return nil, err
		}
		session = s
	} else if config.Session != nil {
		session = config.Session
	} else {
		return nil, errors.New("未知的MongoDB连接")
	}
	if config.Collection == "" {
		config.Collection = DefaultCollection
	}
	return &MongoStore{
		config:  config,
		session: session,
		lg:      log.New(os.Stdout, "[Mongo-Store]", log.LstdFlags),
	}, nil
}
func NewMongoStore(config MongoConfig) (*MongoStore, error) {
	var session *mgo.Session
	if config.URL != "" {
		s, err := mgo.Dial(config.URL)
		if err != nil {
			return nil, err
		}
		session = s
	} else if config.Session != nil {
		session = config.Session
	} else {
		return nil, errors.New("未知的MongoDB连接")
	}
	if config.Collection == "" {
		config.Collection = DefaultCollection
	}
	return &MongoStore{
		config:  config,
		session: session,
		lg:      log.New(os.Stdout, "[Mongo-Store]", log.LstdFlags),
	}, nil
}
func NewMongoStore ( config MongoConfig ) ( * MongoStore , error ) { var session * mgo . Session if config . URL != " " { s , err := mgo . Dial ( config . URL ) if err != nil { return nil , err } session = s } else if config . Session != nil { session = config . Session } else { return nil , errors . New ( " } if config . Collection == " " { config . Collection = DefaultCollection } return & MongoStore { config : config , session : session , lg : log . New ( os . Stdout , " " , log . LstdFlags ) , } , nil }
// NewMongoStore 创建敏感词MongoDB存储
NewMongoStore 创建敏感词MongoDB存储