0
我试图用autoValue在我的架构流星aldeed /流星collection2 autoValue抛出错误
Posts.schema = new SimpleSchema({
title: { type: String },
description: { type: String },
posted: { type: Date,
autoValue: function(){
return new Date;
},
},
likes: { type: Number, defaultValue: 0, optional: true },
dislikes: { type: Number, defaultValue: 0, optional: true, },
author: { type: AuthorSchema },
votes: { type: [AuthorSchema], optional: true }
});
Posts.attachSchema(Posts.schema);
我使用这个架构验证此:
它不工作。我得到一个错误信息
发布需要[验证错误]
我做错什么了吗?我需要使发布字段可选吗?
我试图通过提供default:new Date()的默认值来更改插入方法。也没有工作。请帮忙。