From e38b233012c3f11b0a78b5d25fb6c556fa61b559 Mon Sep 17 00:00:00 2001 From: mohammad0-0ahmad Date: Tue, 21 Jun 2022 23:56:53 +0200 Subject: [PATCH] Refactor virtuals.md --- docs/typescript/virtuals.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/typescript/virtuals.md b/docs/typescript/virtuals.md index 8684aa678c4..b73602960a2 100644 --- a/docs/typescript/virtuals.md +++ b/docs/typescript/virtuals.md @@ -3,7 +3,7 @@ [Virtuals](/docs/tutorials/virtuals.html) are computed properties: you can access virtuals on hydrated Mongoose documents, but virtuals are **not** stored in MongoDB. Mongoose supports auto typed virtuals so you don't need to define additional typescript interface anymore but you are still able to do so. -### 1- Auto types: +### Automatically Inferred Types: To make mongoose able to infer virtuals type, You have to define them in schema constructor as following: @@ -28,7 +28,7 @@ const schema = new Schema( ); ``` -### 2- Manual types: +### Set virtuals type manually: You shouldn't define virtuals in your TypeScript [document interface](/docs/typescript.html). Instead, you should define a separate interface for your virtuals, and pass this interface to `Model` and `Schema`.