KeystoneJS关系字段不保存空值
问题描述:
在KeystoneJS定期Relationship
场(categories
在这个例子中):KeystoneJS关系字段不保存空值
Post.add({
author: { type: Types.Relationship, ref: 'User' },
categories: { type: Types.Relationship, ref: 'PostCategory', many: true }
});
最初它是空的,但是当我增加一些价值给它,保存它,然后将其清除(所以该字段再次为空),保存此型号不会更新categories
。
在Post.schema.pre('save', ...
console.log(this.categories)
表明this.categories
有以前的值,而它应该是空的。
有关此行为的任何想法?