-
I am testing typegoose and I need to know if it is possible to do this conversion |
Beta Was this translation helpful? Give feedback.
Answered by
smolinari
Aug 27, 2021
Replies: 2 comments 8 replies
-
Those SO answers are old. You can implement the import { Base } from '@typegoose/typegoose/lib/defaultClasses';
export class MyEntity implements Base {
_id!: Types.ObjectId;
id!: string;
@Prop({ required: true })
title!: string;
@Prop()
description?: string;
@Prop({ required: true })
completed!: boolean;
... See if that gets you what you need. Scott |
Beta Was this translation helpful? Give feedback.
1 reply
-
@edw19 - What am I looking at as the result above? The https://mongoosejs.com/docs/guide.html#id Scott |
Beta Was this translation helpful? Give feedback.
7 replies
Answer selected by
edw19
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
@edw19 - What am I looking at as the result above? The
id
field is a virtual. It won't be in the database. It's a virtual of_id
.https://mongoosejs.com/docs/guide.html#id
Scott