Skip to content

Commit

Permalink
.
Browse files Browse the repository at this point in the history
  • Loading branch information
Saransh Balyan committed Dec 13, 2024
1 parent 372a580 commit 2e62b41
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions Utils/Mongo/BaseController.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,8 @@ import getError from '#utils/error.js';
const BaseController = (schema) => {
const getCreateOrUpdateFromSchema = async (req, res) => {
try {
const { id } = req.body;
const result = await req.models[schema].findOneAndUpdate(
{ _id: id || new mongoose.Types.ObjectId() },
{ _id: req.body._id || new mongoose.Types.ObjectId() },
{ ...req.body },
{ new: true, upsert: true });

Expand Down

0 comments on commit 2e62b41

Please sign in to comment.