You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I was trying to use ts-mongoose for my project, but I couldn't get this to work:
import{createSchema,Type,typedModel}from'ts-mongoose';constdiscriminatorKey='type';exportconstThingSchema=createSchema({createdBy: Type.objectId({required: true}),isApproved: Type.boolean({required: true}),},{discriminatorKey},);exportconstThing=typedModel('Thing',ThingSchema);exportconstOtherThing=Thing.discriminator('other',createSchema({coolProperty: Type.objectId({required: true}),},{discriminatorKey}),);asyncfunctionfoo(){constf=awaitOtherThing.findOne();console.log(f?.isApproved);// does not compile}
Is there a way to get this to work I'm not seeing?
The text was updated successfully, but these errors were encountered:
I was trying to use
ts-mongoose
for my project, but I couldn't get this to work:Is there a way to get this to work I'm not seeing?
The text was updated successfully, but these errors were encountered: