|
|
@@ -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);
|