# Class ConfigUnitsRepository

Namespace
  adas_core.Infrastructure.Repositories

Assembly
  adas-core.Infrastructure.dll

Repository for managing ConfigUnits in MongoDB. Provides methods to retrieve and manipulate ConfigUnits data.

    public class ConfigUnitsRepository : MongoRepository<ConfigUnits>, IConfigUnitsRepository, IMongoRepository<ConfigUnits>

Inheritance
  object
  MongoRepository<ConfigUnits>
  ConfigUnitsRepository

Implements
  IConfigUnitsRepository
  IMongoRepository<ConfigUnits>

Inherited Members
  MongoRepository<ConfigUnits>.Db
  MongoRepository<ConfigUnits>.Collection
  MongoRepository<ConfigUnits>.InsertOneAsync(ConfigUnits)
  MongoRepository<ConfigUnits>.UpdateOneAsync(ObjectId, ConfigUnits)
  MongoRepository<ConfigUnits>.DeleteAsync(ObjectId)
  MongoRepository<ConfigUnits>.CreateIndexes()
  MongoRepository<ConfigUnits>.InsertInitialLoad()
  MongoRepository<ConfigUnits>.InsertManyAsync(List<ConfigUnits>)
  MongoRepository<ConfigUnits>.UpdateManyObjectIdAsync(string, ObjectId, ObjectId)
  MongoRepository<ConfigUnits>.DeleteAsync(string)
  MongoRepository<ConfigUnits>.CollectionExists(string)
  object.Equals(object)
  object.Equals(object, object)
  object.GetHashCode()
  object.GetType()
  object.MemberwiseClone()
  object.ReferenceEquals(object, object)
  object.ToString()

Extension Methods
  NumberUtils.IsNumber(object)
  NumberUtils.ToDouble(object)
  ObjectUtils.ToStr(object?)

## Constructors

### ConfigUnitsRepository(IOptions<ApiSettings>, IMongoDatabase)

Initializes a new instance of the ConfigUnitsRepository class with the specified API settings and MongoDB database.

    public ConfigUnitsRepository(IOptions<ApiSettings> apiSettings, IMongoDatabase database)

#### Parameters

`apiSettings` IOptions<ApiSettings>

  The API settings.

`database` IMongoDatabase

  The MongoDB database.

#### Exceptions

ArgumentNullException

  Thrown when apiSettings is null.

## Methods

### FindById(string)

Finds a ConfigUnits document by its unique identifier. This method queries the MongoDB collection for a document with the specified ID and returns it if found, or null if not found.

    public Task<ConfigUnits?> FindById(string id)

#### Parameters

`id` string

  The unique identifier of the ConfigUnits document.

#### Returns

Task<ConfigUnits>

  The ConfigUnits document if found; otherwise, null.

### GetCollectionName()

Gets the name of the MongoDB collection for ConfigUnits. This method retrieves the collection name from the API settings, or defaults to "config_units" if not specified.

    public override string GetCollectionName()

#### Returns

string

  The name of the MongoDB collection for ConfigUnits.