git-zodyac / mongoose

Converts your Zod schemas into fully-functional Mongoose schemas
https://www.npmjs.com/package/@zodyac/zod-mongoose
31 stars 5 forks source link

How to handle the default values for array #10

Closed gihanrangana closed 3 months ago

gihanrangana commented 3 months ago

i have zod object like this

 const schema = z.object({
    firstName: z.string().optional(),
    lastName: z.string().optional(),
    email: z.string().email().describe('unique'),
    username: z.string().min(3).max(20).describe('unique'),
    password: z.string(),
    roles: z.array(z.string()).default(['user'])
});

the default value for roles is not assigning

bebrasmell commented 3 months ago

Hi! This feature is to come with the version 2.0.0 asap