Steven Fukase 4 лет назад
Родитель
Сommit
972ba41dd4
1 измененных файлов с 2 добавлено и 0 удалено
  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 {
       const query = { userId: req.user.id };
       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 response = await EditorSettings.findOneAndUpdate(query, update, options);
       return res.apiv3(response);