The code in the controller is as follows:
The parameters received by removeStaff have two fields.ids data type is an array, and the array stores the sid of the field to be deleted
The exposed models are as follows:
Is it possible to use the deletemany method? This method has never been used... Is there any database guy who can give me a try and give me an answer? T——T
滿天的星座2017-05-17 09:58:52
You misunderstood the meaning of the deletemany method. When multiple documents have similar data, such as multiple employees with different ages, if you want to delete the data of all employees over 30 years old at one time, use Model.deleteMany({ age: { $gte: 30 } }, function (err) {})
, if you can find some commonality in the sid (regular matching will also work), you can use deletemany, but I estimate that this is almost impossible, and deleting multiple times in a loop is inevitable.