Explorar o código

FB commenting

Steven Fukase %!s(int64=4) %!d(string=hai) anos
pai
achega
972ba41dd4
Modificáronse 1 ficheiros con 2 adicións e 0 borrados
  1. 2 0
      packages/app/src/server/routes/apiv3/personal-setting.js

+ 2 - 0
packages/app/src/server/routes/apiv3/personal-setting.js

@@ -486,6 +486,8 @@ module.exports = (crowi) => {
     try {
     try {
       const query = { userId: req.user.id };
       const query = { userId: req.user.id };
       const update = req.body;
       const update = req.body;
+      // Insert if document does not exist, and return new values
+      // See: https://mongoosejs.com/docs/api.html#model_Model.findOneAndUpdate
       const options = { upsert: true, new: true };
       const options = { upsert: true, new: true };
       const response = await EditorSettings.findOneAndUpdate(query, update, options);
       const response = await EditorSettings.findOneAndUpdate(query, update, options);
       return res.apiv3(response);
       return res.apiv3(response);