# Class DBServiceInstance

#### Hierarchy (view full)

- RWSService
  - DBServiceInstance

- Defined in src/services/DBService.ts:15

#####
Index

### Constructors

constructor

### Properties

_RELOADABLE
client
connected
opts
_instances

### Methods

cloneDatabase
collectionExists
connectToDB
createBaseMongoClient
createBaseMongoClientDB
createTimeSeriesCollection
delete
findBy
findOneBy
getCollectionHandler
getReloadable
insert
reloadService
update
watchCollection
getSingleton

## Constructors

### constructor

- new DBServiceInstance(opts?): DBServiceInstance

- #### Parameters

  - ##### opts: IDBClientCreate = null

  #### Returns DBServiceInstance

  Overrides RWSService.constructor

  - Defined in src/services/DBService.ts:20

## Properties

### _RELOADABLE

_RELOADABLE: boolean = false

Inherited from RWSService._RELOADABLE

- Defined in src/services/_service.ts:2

### `Private` client

client: PrismaClient<PrismaClientOptions, never, DefaultArgs>

- Defined in src/services/DBService.ts:16

### `Private` connected

connected: boolean = false

- Defined in src/services/DBService.ts:18

### `Private` opts

opts: IDBClientCreate = null

- Defined in src/services/DBService.ts:17

### `Static` `Protected` _instances

_instances: {
[key: string]: RWSService;
} = {}

#### Type declaration

- ##### [key: string]: RWSService

Inherited from RWSService._instances

- Defined in src/services/_service.ts:7

## Methods

### cloneDatabase

- cloneDatabase(source, target): Promise<void>

- #### Parameters

  - ##### source: string

  - ##### target: string

  #### Returns Promise<void>

  - Defined in src/services/DBService.ts:75

### collectionExists

- collectionExists(collection_name): Promise<boolean>

- #### Parameters

  - ##### collection_name: string

  #### Returns Promise<boolean>

  - Defined in src/services/DBService.ts:191

### `Private` connectToDB

- connectToDB(opts?): void

- #### Parameters

  - ##### opts: IDBClientCreate = null

  #### Returns void

  - Defined in src/services/DBService.ts:25

### `Private` createBaseMongoClient

- createBaseMongoClient(): Promise<MongoClient>

- #### Returns Promise<MongoClient>

  - Defined in src/services/DBService.ts:57

### `Private` createBaseMongoClientDB

- createBaseMongoClientDB(): Promise<Db>

- #### Returns Promise<Db>

  - Defined in src/services/DBService.ts:68

### createTimeSeriesCollection

- createTimeSeriesCollection(collection_name): Promise<Collection<ITimeSeries>>

- #### Parameters

  - ##### collection_name: string

  #### Returns Promise<Collection<ITimeSeries>>

  - Defined in src/services/DBService.ts:212

### delete

- delete(collection, conditions): Promise<void>

- #### Parameters

  - ##### collection: string

  - ##### conditions: any

  #### Returns Promise<void>

  - Defined in src/services/DBService.ts:167

### findBy

- findBy(collection, conditions, fields?, ordering?): Promise<IRWSModel[]>

- #### Parameters

  - ##### collection: string

  - ##### conditions: any

  - ##### fields: string[] = null

  - ##### ordering: {
    [fieldName: string]: string;
    } = null

    - ##### [fieldName: string]: string

  #### Returns Promise<IRWSModel[]>

  - Defined in src/services/DBService.ts:173

### findOneBy

- findOneBy(collection, conditions, fields?, ordering?): Promise<IRWSModel>

- #### Parameters

  - ##### collection: string

  - ##### conditions: any

  - ##### fields: string[] = null

  - ##### ordering: {
    [fieldName: string]: string;
    } = null

    - ##### [fieldName: string]: string

  #### Returns Promise<IRWSModel>

  - Defined in src/services/DBService.ts:149

### `Private` getCollectionHandler

- getCollectionHandler(collection): any

- #### Parameters

  - ##### collection: string

  #### Returns any

  - Defined in src/services/DBService.ts:236

### getReloadable

- getReloadable(): string

- #### Returns string

  Inherited from RWSService.getReloadable

  - Defined in src/services/_service.ts:19

### insert

- insert(data, collection, isTimeSeries?): Promise<any>

- #### Parameters

  - ##### data: any

  - ##### collection: string

  - ##### isTimeSeries: boolean = false

  #### Returns Promise<any>

  - Defined in src/services/DBService.ts:109

### reloadService

- reloadService<T>(this, ...params): InstanceType<T>

- #### Type Parameters

  - #### T extends (new (...args) => RWSService)

  #### Parameters

  - ##### this: T

  - ##### `Rest` ...params: any[]

  #### Returns InstanceType<T>

  Inherited from RWSService.reloadService

  - Defined in src/services/_service.ts:23

### update

- update(data, collection): Promise<IRWSModel>

- #### Parameters

  - ##### data: any

  - ##### collection: string

  #### Returns Promise<IRWSModel>

  - Defined in src/services/DBService.ts:131

### watchCollection

- watchCollection(collectionName, preRun): Promise<any>

- #### Parameters

  - ##### collectionName: string

  - ##### preRun: (() => void)

    - - (): void

      - #### Returns void

  #### Returns Promise<any>

  - Defined in src/services/DBService.ts:94

### `Static` getSingleton

- getSingleton<T>(this): InstanceType<T>

- #### Type Parameters

  - #### T extends (new (...args) => RWSService)

  #### Parameters

  - ##### this: T

  #### Returns InstanceType<T>

  Inherited from RWSService.getSingleton

  - Defined in src/services/_service.ts:9

Generated using TypeDoc