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
Originally posted by DocAmaroo October 24, 2022
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.
@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…
Discussed in #12586
Originally posted by DocAmaroo October 24, 2022
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.
The text was updated successfully, but these errors were encountered: