I want to delete the document in a collection., In feathers accept only id not any specific property name for deletion.
My url is: http://localhost:8080/workers?userId=3
function(hook,next){
if(hook.params.query.userId){
hook.app.service('users')
.remove({ query: {userId: hook.params.query.userId}})
.then(result=>{
console.log(result,'result');
});
} else {
next();
}
}
You will need to find the id of the document and then pass that into the remove method afaik. This is much safer than attempting to delete on a property value.
Send the extra parameters as query parameters in the URL eg
/delete/<id>/?param1=value1¶m2=value2
then access these parameters in your service as
const {param1, param2} = params.query;
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.