虽然我尝试处理模型之间的关系但是我无法更新数据库,但是我收到此错误。
(KeystoneJS)保存更改时出错:在路径“techstack”(CastError)中将值“[object Object]”强制转换为未定义失败
请指导我,谢谢:
这是我的代码:
var keystone = require('keystone');
var Types = keystone.Field.Types;
var TechStack = new keystone.List('TechStack', {
autokey: { from: 'name', path: 'key', unique: true}
});
TechStack.add({
name: { type: String, index: true},
techtitle: { type: Types.Html, wysiwyg: true, height: 50 },
technology: { type: Types.Html, wysiwyg: true, height: 50 },
info: { type: Types.Html, wysiwyg: true, height: 50 }
// typetitle: { type: Types.Html, wysiwyg: true, height: 50 },
});
TechStack.relationship({ref: 'ServiceType', path: 'techstack'});
TechStack.schema.virtual('content.full').get(function() {
return this.name || this.techtitle || this.technology || this.info ;
});
TechStack.register();
错误是:
CSRF failure POST { action: 'updateItem',
_csrf: 'CAbEzQIpVPzPCl8qDazH2jMHqALVkTyffJbAI=',
type: 'Web Development',
title: '<p>Web Development</p>',
brief: '<p>Technologies We Work On:</p>',
description: '<p>solutions that drive your customers to fall in love with your product.</p>\r\n<h4 style="text-align: left;"> </h4>',
techstack: '56ba061b937861e432d4a833' }
POST /keystone/service-types/56b0aeb93525d7816aad3d34 200 915.976 ms
GET /keystone/api/service-types/56b0aeb93525d7816aad3d34?drilldown=true 304 9.947 ms
GET /keystone/api/tech-stacks/autocomplete?context=relationship&q=&list=service-types&field=techstack& 304 13.711 ms
GET /keystone/api/tech-stacks/56ba061b937861e432d4a833?simple 304 3.958 ms
GET /keystone/api/tech-stacks/autocomplete?context=relationship&q=[object%20Object]&list=service-types&field=techstack& 304 7.118 ms
Error saving changes to Service Type 56b0aeb93525d7816aad3d34:
{ [CastError: Cast to undefined failed for value "[object Object]" at path "techstack"]
message: 'Cast to undefined failed for value "[object Object]" at path "techstack"',
name: 'CastError',
type: undefined,
value: [{"info":"<p style=\"padding-left: 30px;\">A breakthrough web framework that allows us to serve full-fledged applications in a fraction of the time it would take for most projects.</p>","technology":"<ul>\r\n<li>Ruby on Rails</li>\r\n</ul>"}],
path: 'techstack' }