title: Remove certain fields from the mongoose HydratedDocument
body: <p>When we lean the documents, the <code>id</code> property is still included which is undefined and can cause unexpected errors.</p>
  <p>To simplify this for my team, I want to remove the <code>id</code> field from the HydratedDocument in the custom types.</p>
  <pre><code>// @types/mongoose/index.d.ts
  
  import 'mongoose';
  import { HydratedDocument as _Hydra, Document as _Docu } from 'mongoose';
  
  declare module 'mongoose' {
    export type HydratedDocument&lt;T, TMethodsAndOverrides, TVirtuals&gt; = Omit&lt;_Hydra&lt;T&gt;, 'id' | '__v'&gt;;
  </code></pre>
  <pre><code>// tsconfig.json
  &quot;typeRoots&quot;: [&quot;node_modules/@types&quot;, &quot;@types&quot;] 
  </code></pre>
  <p>It is still not working for me. When I import the typing and try to declare a variable. Then I found that actually <code>id</code> property is coming from Document class. Following is the updated typings</p>
  <pre><code>import 'mongoose';
  import { HydratedDocument as _Hydra, Document as _Docu } from 'mongoose';
  
  declare module 'mongoose' {
    export type HydratedDocument&lt;T, TMethodsAndOverrides, TVirtuals&gt; = Omit&lt;_Hydra&lt;T&gt;, 'id' | '__v'&gt;;
    export class Document implements Omit&lt;_Docu, 'id'&gt; {}
  }
  </code></pre>
  <p>Unfortunately, this is also not working.</p>
  <p><a href="https://i.stack.imgur.com/gBW02.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/gBW02.png" alt="enter image description here" /></a></p>