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
Before to open an issue, I wanted to ask if this was a default behavior.
I tried to create a pre hook with the deleteOne method and I couldn't access to the model of my class.
@Schema()exportclassMyClass{
@Prop()
...
}exporttypeMyClassDocument=SimulationDataset&Document;exportconstMySchema=SchemaFactory.createForClass(MyClass);MySchema.pre('deleteOne',function(){this.model;// TS2551: Property 'model' does not exist on type 'Document<unknown, any, SimulationDataset> & SimulationDataset & { _id: ObjectId; }'. Did you mean '$model'? });
Error received
TS2551: Property 'model' does not exist on type 'Document<unknown, any, SimulationDataset> & SimulationDataset & { _id: ObjectId; }'. Did you mean '$model'?
See screenshot
But this property is accessible from other method like deleteMany, findOneAndDelete etc…
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
Hi guys!
Before to open an issue, I wanted to ask if this was a default behavior.
I tried to create a pre hook with the
deleteOne
method and I couldn't access to the model of my class.Error received
TS2551: Property 'model' does not exist on type 'Document<unknown, any, SimulationDataset> & SimulationDataset & { _id: ObjectId; }'. Did you mean '$model'?
See screenshot
But this property is accessible from other method like
deleteMany
,findOneAndDelete
etc…Configuration
Is this a normal behavior, or am I missing something from the documentation ?
Thank you in advance for your response.
Beta Was this translation helpful? Give feedback.
All reactions