# Class MongooseService

Class
Module
import { MongooseService } from "@tsed/mongoose"
Source/packages/mongoose/src/services/MongooseService.ts

# Overview

class MongooseService {
    readonly connections: Map<string, Mongoose.Connection>;
logger<span class="token punctuation">:</span> Logger<span class="token punctuation">;</span>

<span class="token function">connect</span><span class="token punctuation">(</span>id<span class="token punctuation">:</span> <span class="token keyword">string</span><span class="token punctuation">,</span> url<span class="token punctuation">:</span> <span class="token keyword">string</span><span class="token punctuation">,</span> connectionOptions<span class="token punctuation">:</span> ConnectOptions<span class="token punctuation">,</span> isDefault?<span class="token punctuation">:</span> <span class="token keyword">boolean</span><span class="token punctuation">)</span><span class="token punctuation">:</span> Promise&lt;<span class="token keyword">any</span>&gt;<span class="token punctuation">;</span>

<span class="token function">get</span><span class="token punctuation">(</span>id?<span class="token punctuation">:</span> <span class="token keyword">string</span><span class="token punctuation">)</span><span class="token punctuation">:</span> Mongoose.Connection | undefined<span class="token punctuation">;</span>

<span class="token function">has</span><span class="token punctuation">(</span>id?<span class="token punctuation">:</span> <span class="token keyword">string</span><span class="token punctuation">)</span><span class="token punctuation">:</span> <span class="token keyword">boolean</span><span class="token punctuation">;</span>
<span class="token function">closeConnections</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">:</span> Promise&lt;<span class="token keyword">void</span>&gt;<span class="token punctuation">;</span>

}

# Members

readonly connections: Map<string, Mongoose.Connection>;

logger: Logger;

connect(id: string, url: string, connectionOptions: ConnectOptions, isDefault?: boolean): Promise<any>;

get(id?: string): Mongoose.Connection | undefined;

has(id?: string): boolean;

closeConnections(): Promise<void>;

Other topics