INNER CODE UNIT · Go
func
apache/casbin-mongodb-adapter · adapter.go:179
func (a *adapter) open(clientOption *options.ClientOptions, databaseName string, collectionName string) error {
client, err := mongo.Connect(clientOption)
if err != nil {
return err
}
db := client.Database(databaseName)
collection := db.Collection(collectionName)
a.client = client
a.collection = collection
if err = a.prepareIndexes(); err != nil {
return err
}
return nil
}