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 can pass null
as the id to remove
to remove entries according to a query. It is documented here and here. So
hook.app.service('users').remove(null, { query: {userId: hook.params.query.userId}})
Should do what you want.