# Class PatientCarePlanRepository

Namespace
  adas_core.Infrastructure.Repositories

Assembly
  adas-core.Infrastructure.dll

Represents a MongoDB-backed repository for managing PatientCarePlan entities, providing concrete persistence operations defined by the IPatientCarePlanRepository contract.

    public class PatientCarePlanRepository : MongoRepository<PatientCarePlan>, IPatientCarePlanRepository, IMongoRepository<PatientCarePlan>

Inheritance
  object
  MongoRepository<PatientCarePlan>
  PatientCarePlanRepository

Implements
  IPatientCarePlanRepository
  IMongoRepository<PatientCarePlan>

Inherited Members
  MongoRepository<PatientCarePlan>.Db
  MongoRepository<PatientCarePlan>.Collection
  MongoRepository<PatientCarePlan>.InsertOneAsync(PatientCarePlan)
  MongoRepository<PatientCarePlan>.UpdateOneAsync(ObjectId, PatientCarePlan)
  MongoRepository<PatientCarePlan>.DeleteAsync(ObjectId)
  MongoRepository<PatientCarePlan>.CreateIndexes()
  MongoRepository<PatientCarePlan>.InsertInitialLoad()
  MongoRepository<PatientCarePlan>.InsertManyAsync(List<PatientCarePlan>)
  MongoRepository<PatientCarePlan>.UpdateManyObjectIdAsync(string, ObjectId, ObjectId)
  MongoRepository<PatientCarePlan>.DeleteAsync(string)
  MongoRepository<PatientCarePlan>.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

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

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

#### Parameters

`apiSettings` IOptions<ApiSettings>
`database` IMongoDatabase

## Methods

### FindAll()

Retrieves all patient care plans from the data store without applying any filter.

    public Task<List<PatientCarePlan>> FindAll()

#### Returns

Task<List<PatientCarePlan>>

  A task that represents the asynchronous operation, containing a list of all PatientCarePlan records.

### FindByPatientId(ObjectId)

Retrieves all care plans associated with the specified patient identifier from the data store. Returns an empty list when no matching care plans exist for the patient.

    public Task<List<PatientCarePlan>> FindByPatientId(ObjectId patientId)

#### Parameters

`patientId` ObjectId

  The unique identifier of the patient whose care plans should be retrieved.

#### Returns

Task<List<PatientCarePlan>>

  A task that represents the asynchronous operation. The task result contains a list of PatientCarePlan objects associated with the specified patient, or an empty list if none are found.

### FindByUserId(ObjectId)

Retrieves all patient care plans associated with the specified user identifier from the collection.

    public Task<List<PatientCarePlan>> FindByUserId(ObjectId userId)

#### Parameters

`userId` ObjectId

  The unique identifier of the user whose patient care plans are being queried.

#### Returns

Task<List<PatientCarePlan>>

  A list of PatientCarePlan instances matching the specified user identifier; an empty list is returned if no plans are found.

### GetCollectionName()

Returns the collection name for patient care plan data, using the configured setting if available or a default fallback otherwise.

    public override string GetCollectionName()

#### Returns

string

  The patient care plan collection name from `_apiSettings.PatientCarePlan`, or `"patients_care_plan"` when the setting is null.

### UpdateManyObjectId(string, ObjectId, ObjectId)

Asynchronously updates multiple object identifiers for a patient by delegating to the underlying asynchronous operation.

    public Task UpdateManyObjectId(string patientid, ObjectId patientId, ObjectId oldId)

#### Parameters

`patientid` string

  The string identifier of the patient whose object identifiers will be updated.

`patientId` ObjectId

  The new MongoDB.Bson.ObjectId to assign to the patient's records.

`oldId` ObjectId

  The existing MongoDB.Bson.ObjectId to be replaced.

#### Returns

Task