cc-core-cli
Version:
Command Line Interface tool for generating project templates for the (Your Platform's Name) platform.
13 lines (10 loc) • 442 B
text/typescript
import * as mongoose from "mongoose";
import { Prop, Schema } from "@nestjs/mongoose";
import { BaseSchema, BaseSchemaFactory } from "@shopstack/cc-core-lib/core";
@Schema({ strict: false, timestamps: true })
export class Example extends BaseSchema {
@Prop({ is_unique: true, required: true })
name: string;
}
export const ExampleSchema = BaseSchemaFactory.createForClass(Example);
ExampleSchema.index({ name: 1 }, { unique: true });