'Nest Js, how to correctly set _id property in your schema
I know it seems quite basic, but I can't seem to find the correct way of setting up the _id field in the Nest.js mongoose schema. I've attached an image, and was just wondering what the best way to set this property? I get the following error
'SchemaType' only refers to a type, but is being used as a namespace here.ts(2702)
Solution 1:[1]
When defining your Mongoose schema in NestJS you really don't have to specify the _id field and all will be fine.
If you want to explicitly define it you have to use following:
...
_id: Schema.Types.ObjectId
...
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | Torsten Barthel |

