# Class Databases<C>`Abstract`

Aggegrates logic for interacting wth a set of PouchDB databases identified by resource collection name.

#### Type Parameters

- #### C extends Meta.Collections

#### Hierarchy

- Databases
  - Meta.Pouch.Adapters.Couch.Databases
  - Meta.Pouch.Adapters.Memory.Databases
  - Meta.Pouch.Adapters.IndexedDb.Databases

#### Implements

- Meta.Pouch.Adapter<C>

- Defined in packages/db/src/meta/pouch/adapters/base.ts:29

#####
Index

### Constructors

constructor

### Properties

collections
definitions
generateId
ready

### Methods

createDatabase
delete
every
initialize
initializeCollection
retrieve
save
search
setup

## Constructors

### constructor

- new Databases<C>(options): Meta.Pouch.Adapters.Base.Databases<C>

- #### Type Parameters

  - #### C extends Meta.Collections

  #### Parameters

  - ##### options: DatabasesOptions<C>

  #### Returns Meta.Pouch.Adapters.Base.Databases<C>

  - Defined in packages/db/src/meta/pouch/adapters/base.ts:36

## Properties

### `Private` collections

collections: CollectionDatabases<C>

- Defined in packages/db/src/meta/pouch/adapters/base.ts:30

### `Private` definitions

definitions: Meta.Pouch.Definitions<C>

- Defined in packages/db/src/meta/pouch/adapters/base.ts:31

### `Private` generateId

generateId: GenerateId<C>

- Defined in packages/db/src/meta/pouch/adapters/base.ts:32

### `Private` ready

ready: Promise<void>

- Defined in packages/db/src/meta/pouch/adapters/base.ts:34

## Methods

### `Protected` `Abstract` createDatabase

- createDatabase(resource): Database<{}>

- #### Parameters

  - ##### resource: Meta.CollectionName<C>

  #### Returns Database<{}>

  - Defined in packages/db/src/meta/pouch/adapters/base.ts:56

### delete

- delete<N, T>(collectionName, references): Promise<void>

- Delete saved records

  #### Type Parameters

  - #### N extends string

  - #### T

  #### Parameters

  - ##### collectionName: N

  - ##### references: (undefined | RecordReference<T>)[]

    Can be sparse

  #### Returns Promise<void>

  Implementation of Adapter.delete

  - Defined in packages/db/src/meta/pouch/adapters/base.ts:217

### every

- every<N, T>(collectionName): Promise<SavedRecord<T>[]>

- Retrieve and return every saved record for a given collection name

  #### Type Parameters

  - #### N extends string

  - #### T

  #### Parameters

  - ##### collectionName: N

  #### Returns Promise<SavedRecord<T>[]>

  Implementation of Adapter.every

  - Defined in packages/db/src/meta/pouch/adapters/base.ts:83

### `Private` initialize

- initialize(): Promise<void>

- #### Returns Promise<void>

  - Defined in packages/db/src/meta/pouch/adapters/base.ts:60

### `Private` initializeCollection

- initializeCollection<N>(collectionName, definition): Promise<void>

- #### Type Parameters

  - #### N extends string

  #### Parameters

  - ##### collectionName: N

  - ##### definition: Meta.Pouch.Definition<C, N>

  #### Returns Promise<void>

  - Defined in packages/db/src/meta/pouch/adapters/base.ts:70

### retrieve

- retrieve<N, T>(collectionName, records): Promise<(undefined | SavedRecord<T>)[]>

- Retrieve specific saved records of a given collection name by list of references.

  #### Type Parameters

  - #### N extends string

  - #### T

  #### Parameters

  - ##### collectionName: N

  - ##### records: (undefined | Pick<Record<T>, "_id">)[]

    Can be sparse

  #### Returns Promise<(undefined | SavedRecord<T>)[]>

  - Items in list correspond to `references` by index (also sparse)

  Implementation of Adapter.retrieve

  - Defined in packages/db/src/meta/pouch/adapters/base.ts:100

### save

- save<N, T>(collectionName, records, options?): Promise<(undefined | SavedRecord<T>)[]>

- Create or update saved records of a given collection name.

  #### Type Parameters

  - #### N extends string

  - #### T

  #### Parameters

  - ##### collectionName: N

  - ##### records: (undefined | Record<T>)[]

    Can be sparse

  - ##### options: {
    overwrite?: boolean;
    } = {}

    - ##### `Optional` overwrite?: boolean

  #### Returns Promise<(undefined | SavedRecord<T>)[]>

  - Items in list correspond to `records` by index (also sparse)

  Implementation of Adapter.save

  - Defined in packages/db/src/meta/pouch/adapters/base.ts:145

### search

- search<N, T>(collectionName, options): Promise<SavedRecord<T>[]>

- Search for saved records of a given collection name by PouchDB find syntax

  #### Type Parameters

  - #### N extends string

  - #### T

  #### Parameters

  - ##### collectionName: N

  - ##### options: FindRequest<{}>

  #### Returns Promise<SavedRecord<T>[]>

  Implementation of Adapter.search

  - Defined in packages/db/src/meta/pouch/adapters/base.ts:132

### `Protected` setup

- setup(_): void

- #### Parameters

  - ##### _: any

  #### Returns void

  - Defined in packages/db/src/meta/pouch/adapters/base.ts:54

Generated using TypeDoc