我想知道是否有人知道为什么我得到这个错误,我的模型
var Test = new keystone.List('Test', {
autokey: { from: 'title', path: 'key', unique: true }
});
Test.add({
title: { type: String, required: true },
我所做的只是更改下面帖子示例中的值
var Test = new keystone.List('Test', {
autokey: { from: 'name', path: 'key', unique: true }
});
Test.add({
name: { type: String, required: true },
我不明白为什么它适用于名称而不是标题
在选项列表中使用映射键
var Test = new keystone.List('Test', {
map: { name: 'title' },
autokey: { from: 'title', path: 'key', unique: true }
});
参考: http://keystonejs.com/docs/database/#lists-options
将字段映射到特殊列表路径的对象。每个路径默认值 如果添加了具有该键的字段,则添加到其键。可映射路径包括 名称 - 包含项目名称的字段,用于显示在 管理界面