Fix (crud) update: findOnefindById

b/c `findById` uses an index to lookup, and should be fast.
This commit is contained in:
Joey Baker 2016-09-04 15:35:19 -07:00
parent b35bd23c91
commit 32a539c3d9

View File

@ -243,11 +243,7 @@ export const update = ({ server, model, prefix = '/', config }) => {
@error @error
async handler(request, reply) { async handler(request, reply) {
const { id } = request.params; const { id } = request.params;
const instance = await model.findOne({ const instance = await model.findById(id);
where: {
id,
},
});
if (!instance) return void reply(notFound(`${id} not found.`)); if (!instance) return void reply(notFound(`${id} not found.`));