NestJS module that provides seamless integration between NestJS and Mongoose ODM for MongoDB database operations
80
Pending
Does it follow best practices?
Impact
80%
1.02xAverage score across 10 eval scenarios
Pending
The risk profile of this skill
Module that registers catalog-related models using asynchronous configuration sources before the Nest application starts.
collection: "products" and ttlDays: 14, importing the module exposes a model bound to that collection with base fields sku, price, apiKey, token, createdAt, and expiresAt, plus a TTL index on expiresAt that expires documents 14 days after createdAt. @testcollection: "products-archived" before module initialization, the exposed model uses that collection name while preserving all base fields. @test["apiKey", "token"], fields with matching keys are required strings that are excluded from query selection and removed from secondary indexes. @testdigital and physical, the child models share base fields sku and price while adding downloadUrl or weight; saving and retrieving each child preserves both base and child-specific fields. @test@generates
export interface ProductConfig {
collection: string;
ttlDays: number;
}
export interface SecretsPolicy {
secrets: string[];
}
export interface DiscriminatorShape {
name: string;
fields: Record<string, unknown>;
}
export interface ProductAttributes {
sku: string;
price: number;
apiKey?: string;
token?: string;
createdAt: Date;
expiresAt?: Date;
}
export interface AsyncModelsOptions {
connectionName?: string;
loadConfig(): Promise<ProductConfig>;
loadSecrets?(): Promise<SecretsPolicy>;
loadDiscriminators?(): Promise<DiscriminatorShape[]>;
}
export class AsyncModelsModule {
/**
* Registers the product model and optional discriminators using asynchronous factories.
*/
static register(options: AsyncModelsOptions): import('@nestjs/common').DynamicModule;
}Provides MongoDB model integration with asynchronous schema registration. @satisfied-by
docs
evals
scenario-1
scenario-2
scenario-3
scenario-4
scenario-5
scenario-6
scenario-7
scenario-8
scenario-9
scenario-10