ts-mongoose icon indicating copy to clipboard operation
ts-mongoose copied to clipboard

How do I create a recursive scheme?

Open RusAnonym opened this issue 4 years ago • 0 comments

Good afternoon, is it possible to create a recursive scheme?

const products = createSchema({
	id: Type.number({ required: true }),
	products: Type.array({ required: true }).of(products),
});

I tried to create a recursive scheme with .add

const products = createSchema({
	id: Type.number({ required: true }),
});

products.add({
	products: Type.array({ required: true }).of(products),
});

But it didn't help me ;C image

Can you please tell me how to solve this problem?

RusAnonym avatar Jan 12 '21 04:01 RusAnonym