@nestjs/mongoose
- Version 10.1.0
- Published
- 57.8 kB
- No dependencies
- MIT license
Install
npm i @nestjs/mongoose
yarn add @nestjs/mongoose
pnpm add @nestjs/mongoose
Overview
Nest - modern, fast, powerful node.js web framework (@mongoose)
Index
Functions
Classes
Interfaces
Type Aliases
Functions
function getConnectionToken
getConnectionToken: (name?: string) => string;
function getModelToken
getModelToken: (model: string, connectionName?: string) => string;
function InjectConnection
InjectConnection: (name?: string) => PropertyDecorator & ParameterDecorator;
function InjectModel
InjectModel: ( model: string, connectionName?: string) => PropertyDecorator & ParameterDecorator;
function Prop
Prop: (options?: PropOptions) => PropertyDecorator;
function raw
raw: (definition: Record<string, any>) => Record<string, any>;
function Schema
Schema: (options?: mongoose.SchemaOptions) => ClassDecorator;
function Virtual
Virtual: (options?: VirtualOptions) => PropertyDecorator;
Classes
class CannotDetermineTypeError
class CannotDetermineTypeError extends Error {}
constructor
constructor(hostClass: string, propertyKey: string);
class DefinitionsFactory
class DefinitionsFactory {}
method createForClass
static createForClass: (target: Type<unknown>) => mongoose.SchemaDefinition;
class MongooseModule
class MongooseModule {}
method forFeature
static forFeature: ( models?: ModelDefinition[], connectionName?: string) => DynamicModule;
method forFeatureAsync
static forFeatureAsync: ( factories?: AsyncModelFactory[], connectionName?: string) => DynamicModule;
method forRoot
static forRoot: (uri: string, options?: MongooseModuleOptions) => DynamicModule;
method forRootAsync
static forRootAsync: (options: MongooseModuleAsyncOptions) => DynamicModule;
class SchemaFactory
class SchemaFactory {}
method createForClass
static createForClass: <TClass = any>( target: Type<TClass>) => mongoose.Schema<TClass>;
class VirtualsFactory
class VirtualsFactory {}
method inspect
static inspect: <TClass = any>( target: Type<TClass>, schema: mongoose.Schema<TClass>) => void;
Interfaces
interface AsyncModelFactory
interface AsyncModelFactory extends Pick<ModuleMetadata, 'imports'>, Pick<ModelDefinition, 'name' | 'collection' | 'discriminators'> {}
property inject
inject?: any[];
property useFactory
useFactory: ( ...args: any[]) => ModelDefinition['schema'] | Promise<ModelDefinition['schema']>;
interface MongooseModuleAsyncOptions
interface MongooseModuleAsyncOptions extends Pick<ModuleMetadata, 'imports'> {}
property connectionName
connectionName?: string;
property inject
inject?: any[];
property useClass
useClass?: Type<MongooseOptionsFactory>;
property useExisting
useExisting?: Type<MongooseOptionsFactory>;
property useFactory
useFactory?: ( ...args: any[]) => Promise<MongooseModuleFactoryOptions> | MongooseModuleFactoryOptions;
interface MongooseModuleOptions
interface MongooseModuleOptions extends ConnectOptions {}
property connectionErrorFactory
connectionErrorFactory?: (error: MongooseError) => MongooseError;
property connectionFactory
connectionFactory?: (connection: any, name: string) => any;
property connectionName
connectionName?: string;
property lazyConnection
lazyConnection?: boolean;
property onConnectionCreate
onConnectionCreate?: (connection: Connection) => void;
property retryAttempts
retryAttempts?: number;
property retryDelay
retryDelay?: number;
property uri
uri?: string;
property verboseRetryLog
verboseRetryLog?: boolean;
interface MongooseOptionsFactory
interface MongooseOptionsFactory {}
method createMongooseOptions
createMongooseOptions: () => | Promise<MongooseModuleOptions> | MongooseModuleOptions;
interface VirtualOptions
interface VirtualOptions {}
Type Aliases
type DiscriminatorOptions
type DiscriminatorOptions = { name: string; schema: Schema; value?: string;};
type ModelDefinition
type ModelDefinition = { name: string; schema: any; collection?: string; discriminators?: DiscriminatorOptions[];};
type MongooseModuleFactoryOptions
type MongooseModuleFactoryOptions = Omit<MongooseModuleOptions, 'connectionName'>;
type PropOptions
type PropOptions<T = any> = | Partial<mongoose.SchemaDefinitionProperty<T>> | mongoose.SchemaType;
type SchemaOptions
type SchemaOptions = mongoose.SchemaOptions;
Package Files (15)
- dist/common/mongoose.decorators.d.ts
- dist/common/mongoose.utils.d.ts
- dist/decorators/prop.decorator.d.ts
- dist/decorators/schema.decorator.d.ts
- dist/decorators/virtual.decorator.d.ts
- dist/errors/cannot-determine-type.error.d.ts
- dist/factories/definitions.factory.d.ts
- dist/factories/schema.factory.d.ts
- dist/factories/virtuals.factory.d.ts
- dist/index.d.ts
- dist/interfaces/async-model-factory.interface.d.ts
- dist/interfaces/model-definition.interface.d.ts
- dist/interfaces/mongoose-options.interface.d.ts
- dist/mongoose.module.d.ts
- dist/utils/raw.util.d.ts
Dependencies (0)
No dependencies.
Dev Dependencies (26)
- @commitlint/cli
- @commitlint/config-angular
- @nestjs/common
- @nestjs/core
- @nestjs/platform-express
- @nestjs/testing
- @types/jest
- @types/node
- @typescript-eslint/eslint-plugin
- @typescript-eslint/parser
- eslint
- eslint-config-prettier
- eslint-plugin-import
- eslint-plugin-prettier
- husky
- jest
- lint-staged
- mongoose
- prettier
- reflect-metadata
- release-it
- rxjs
- supertest
- ts-jest
- ts-node
- typescript
Peer Dependencies (4)
Badge
To add a badge like this oneto your package's README, use the codes available below.
You may also use Shields.io to create a custom badge linking to https://www.jsdocs.io/package/@nestjs/mongoose
.
- Markdown[![jsDocs.io](https://img.shields.io/badge/jsDocs.io-reference-blue)](https://www.jsdocs.io/package/@nestjs/mongoose)
- HTML<a href="https://www.jsdocs.io/package/@nestjs/mongoose"><img src="https://img.shields.io/badge/jsDocs.io-reference-blue" alt="jsDocs.io"></a>
- Updated .
Package analyzed in 3824 ms. - Missing or incorrect documentation? Open an issue for this package.