- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
这是我的问题:
我想使用 simple-schema 的强大功能来根据以下模式检查我的插入:
let UprocSchema = new SimpleSchema({
"name": { type : String, label: "Nom Uproc" },
"label": { type : String, label: "Libellé Uproc" },
"status": { type : String, label: "Status UPR" }
});
出于某种原因我忽略了,即使 SimpleSchema 看起来实例化得很好,我也不能在 Mongo.Collection 上使用 attachSchema 属性。
这是我的代码:
let repo_collection = new Mongo.Collection('repository');
export const Repository = new MongoObservable.Collection<Uproc>('repo_collection');
repo_collection.attachSchema( UprocSchema );
这是我的错误信息:
Property 'attachSchema' does not exist on type 'Collection<{}>'.
TypeError: repo_collection.attachSchema is not a function
最佳答案
attachSchema
是 [collection2][1]
包的一部分。
Create one or more SimpleSchema instances and then use them to validate objects. By adding the aldeed:collection2 package to your app, you can attach them to collections to get automatic validation of your insert and update operations.
关于simple-schema - 无法在带有 angular2-meteor 的 Mongo.Collection 上找到 attachSchema 属性,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/40616694/
这是我的问题: 我想使用 simple-schema 的强大功能来根据以下模式检查我的插入: let UprocSchema = new SimpleSchema({ "name": { ty
我是一名优秀的程序员,十分优秀!