Closed DipeshGod closed 1 year ago
Hi. Are you sure that's the right code? Decorator is in uppercase such as Factory
and Prop
and must be included in import statement ase well.
I was not running the dev server when I was running the seed script. That was causing the problem. It worked as it is when i did that
`import { Prop, Schema, SchemaFactory } from '@nestjs/mongoose'; import { HydratedDocument } from 'mongoose'; import { Factory } from 'nestjs-seeder';
export type DriverDocument = HydratedDocument;
@Schema() export class Driver { @Factory((faker) => faker.number.int()) @Prop() userId: string;
@Prop() @Factory((faker) => faker.number.int()) serviceId: string;
@Prop() @Factory((faker) => faker.datatype.boolean()) status: boolean;
@Factory((faker) => ({ type: 'Point', coordinates: [faker.location.longitude, faker.location.latitude], })) @Prop({ type: { type: String, default: 'Point', }, coordinates: [Number], }) currentLocation: { type: string; coordinates: number[]; }; }
export const DriverSchema = SchemaFactory.createForClass(Driver);`
Here currenLocation is not populated while seeding, other feilds are created as expected. What am i missing here?