# Mongoose

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

<https://docs.seedcord.org/packages/plugin-mongoose/0.3.0/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 Ready phase, after every attached plugin's `init()` has resolved. The other Ready tasks run alongside it, including the http server binding its port.

Override it when your work needs a logged-in client or a resolved application id.

### 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.
