可以在 sailsjs 中创建新模型后更新 属性 吗?

possible to update a property after new model is created in sailsjs?

我正在尝试为模型创建新记录,但在创建模型后我需要保存一些字段。

我有这样的代码

let new_model = await Model.create({ name, type}).fetch();
new_model.content = 'abc';
new_model.save();
TypeError: new_model.save is not a function

我用谷歌搜索了一下,似乎 sailsjs 不能这样完成,所以我想我必须使用 updateupdateOne by sails。但问题是,name,type 字段不是唯一的,因此使用 update 将实际上变成所有记录的更新。 updateOne 会给我错误提示说有不止一条记录

有人对这里可以做什么有什么建议吗?

我能想到的另一个选择是用 updateOne

做这样的事情
let new_model = await Model.create({ name, type}).fetch();
// getting your content here or do something else
const content = 'abc';
new_model = await Model.updateOne({ id:new_model.id}).set({content});