edwardanthony / nestjs-seeder

An extension library for NestJS to perform seeding.
MIT License
102 stars 21 forks source link

Unable to seed location coordinates #36

Closed DipeshGod closed 1 year ago

DipeshGod commented 1 year ago

`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?

edwardanthony commented 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.

DipeshGod commented 1 year ago

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