I'm try to update mongodb document in single field, I have doubt to which method i want to use either patch or update using feathers framework, give an example how we can do it.
const { authenticate } = require('feathers-authentication').hooks;
module.exports = {
before: {
all: [ authenticate('jwt') ],
find: [],
get: [],
create: [],
update: [],
patch: [],
remove: []
},
after: {
all: [],
find: [],
get: [],
create: [],
update: [],
patch: [],
remove: []
},
error: {
all: [],
find: [],
get: [],
create: [],
update: [],
patch: [],
remove: []
}
};
update
will replace the entire document. To merge with existing datapatch
should be used. This is documented here and here with the following example: