# Mongoose

`class` in `plugin-mongoose` · v0.2.1

<https://docs.seedcord.org/packages/plugin-mongoose/0.2.1/classes/mongoose>

MongoDB integration plugin for Seedcord.

Manages MongoDB connections, service loading, and provides type-safe access to database services through service registration decorators.

```ts
class Mongoose extends Plugin<{
    transport: "any";
    runtime: "server";
}>
```

## Constructors

### constructor

```ts
Mongoose(host: CoreBase, options: MongooseOptions)
```

Constructs a new instance of the `Mongoose` class

## Properties

### connection

```ts
public connection: Mongoose
```

Exposed Mongoose instance once `init` completes.

### core

```ts
protected core: TCore
```

The host, typed to the transport whose `Plugin` base this class extends.

### logger

```ts
protected readonly logger: Logger
```

Logs under the plugin's class name, on the channel its attach key sets.

### services

```ts
public get services(): MongooseServices
```

Map of all loaded services. Keys come from `@RegisterMongooseService('key')`.

## Methods

### dispose

```ts
public async dispose(): Promise<void>
```

### init

```ts
public async init(): Promise<void>
```

### onHmr

```ts
async onHmr(_event: HmrUpdateEvent): Promise<void>
```

Override to reload plugin state on an HMR update.

### ready

```ts
async ready(): Promise<void>
```

Runs in the startup Ready phase, after `init()`. The gateway client is logged in by this phase, and the http host binds its server in the same phase.

### registerCriticalFiles

```ts
protected registerCriticalFiles(
    patterns: string[]
): void
```

Registers critical file patterns that should trigger a full restart when changed in Dev HMR.

### rejectOptions

```ts
protected rejectOptions(reason: string): never
```

Throws a `SeedcordError` that contains the plugin class name and the reason.
