We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Hi,
I am changing the type of the _id in the schema to String, eg:
import { createSchema, Type, ExtractProps } from 'ts-mongoose'; const UserSchema = createSchema({ _id: Type.string(), }); export type User = ExtractProps<typeof UserSchema>; const user = { _id: 'aa' } as User;
So it seems the ExtractProps is not casting the _id to string, therefore User._id type is been defined as ObjectId instead of string
The text was updated successfully, but these errors were encountered:
@zfattuhi-sonalake Have you tried using { _id : false } option? Like following:
{ _id : false }
import { createSchema, Type, ExtractProps } from 'ts-mongoose'; const UserSchema = createSchema({ _id: Type.string(), }, { _id: false }); export type User = ExtractProps<typeof UserSchema>; const user = { _id: 'aa' } as User;
Sorry, something went wrong.
No branches or pull requests
Hi,
I am changing the type of the _id in the schema to String, eg:
So it seems the ExtractProps is not casting the _id to string, therefore User._id type is been defined as ObjectId instead of string
The text was updated successfully, but these errors were encountered: