Skip to content

Commit

Permalink
fix(#579): disable validation (& middleware) for backup loading
Browse files Browse the repository at this point in the history
  • Loading branch information
jannis-baum committed Apr 4, 2023
1 parent a882bef commit c85c350
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion anni/src/pages/api/backup.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,9 @@ const api: NextApiHandler = async (req, res) =>
const data: Record<string, object> = req.body.data;
await Promise.all(
Object.entries(data).map(([name, docs]) =>
mongoose.models[name].insertMany(docs),
mongoose.models[name].create(docs, {
validateBeforeSave: false,
}),
),
);
return { successStatus: 201 };
Expand Down

0 comments on commit c85c350

Please sign in to comment.