@@ -44,9 +44,9 @@ const TestSchema = new Schema({
4444});
4545
4646TestSchema .plugin (softDeletePlugin);
47- const Test = mongoose .model (" Test" , TestSchema);
47+ const TestModel = mongoose .model (" Test" , TestSchema);
4848
49- const test = new Test ({name: ' hello' , lastName: " world" });
49+ const test = new TestModel ({name: ' hello' , lastName: " world" });
5050
5151/** * returns an object containing the number of softDeleted elements ***/
5252/** *
@@ -56,7 +56,7 @@ const test = new Test({name: 'hello', lastName: "world"});
5656 the argument options is optional
5757***/
5858const options = { validateBeforeSave: false };
59- const deleted = await Test .softDelete ({ _id: test ._id , name: test .name }, options);
59+ const deleted = await TestModel .softDelete ({ _id: test ._id , name: test .name }, options);
6060/**
6161 const deleted = await Test.softDelete({ _id: test._id, name: test.name }); is also valid
6262**/
@@ -65,16 +65,16 @@ const deleted = await Test.softDelete({ _id: test._id, name: test.name }, option
6565/** *
6666 {restored: number}
6767***/
68- const restored = await Test .restore ({ _id: test ._id , name: test .name });
68+ const restored = await TestModel .restore ({ _id: test ._id , name: test .name });
6969
7070/** * returns all deleted elements ***/
71- const deletedElements = await Test .findDeleted ();
71+ const deletedElements = await TestModel .findDeleted ();
7272
7373/** * returns all available elements (not deleted) ***/
74- const availableElements = await Test .find ();
74+ const availableElements = await TestModel .find ();
7575
7676/** * counts all available elements (not deleted) ***/
77- const countAvailable = await Test .count ();
77+ const countAvailable = await TestModel .count ();
7878
7979/** * findById returns the document whether deleted or not ***/
8080```
@@ -111,7 +111,7 @@ const test = await new this.testModel({name: 'hello', lastName: 'world'});
111111 the argument options is optional
112112***/
113113const options = { validateBeforeSave: false };
114- const deleted = await Test .softDelete ({ _id: test ._id , name: test .name }, options );
114+ const deleted = await this . testModel .softDelete ({ _id: test ._id , name: test .name }, options );
115115/**
116116 const deleted = await Test.softDelete({ _id: test._id, name: test.name }); is also valid
117117**/
@@ -129,7 +129,7 @@ const deletedElements = await this.testModel.findDeleted();
129129const availableElements = await this .testModel .find ();
130130
131131/** * counts all available elements (not deleted) ***/
132- const countAvailable = await Test .count ();
132+ const countAvailable = await this . test .count ();
133133
134134/** * findById returns the document whether deleted or not ***/
135135```
0 commit comments