Skip to content
This repository has been archived by the owner on Jun 29, 2021. It is now read-only.

[FP] get SchemaType option #375

Closed
rafaelcorreiapoli opened this issue Aug 7, 2019 · 2 comments
Closed

[FP] get SchemaType option #375

rafaelcorreiapoli opened this issue Aug 7, 2019 · 2 comments

Comments

@rafaelcorreiapoli
Copy link

Which feature

var numberSchema = new Schema({
 userId: {
    type: ObjectId,
    get: v => v.toString(),
  }
});

https://mongoosejs.com/docs/schematypes.html#schematype-options

Why do you want it

I need to convert all my ObjectIds to strings

Additional Notes

I need to preserve the name of the field (in this case, userId), so class getters and setters would not work in this case

Thanks!

@hasezoey
Copy link
Contributor

hasezoey commented Aug 7, 2019

already done that:
#260
typegoose/typegoose#5
-> it will be included when 6.0.0 releases

@rafaelcorreiapoli
Copy link
Author

Nice! thanks :) I will close the issue

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants