小编Ron*_*ert的帖子

使用angular2-meteor在Mongo.Collection上找不到attachSchema属性

这是我的问题:

我想使用simple-schema的强大功能来检查我对以下模式的插入:

let UprocSchema = new SimpleSchema({
    "name": { type : String, label: "Nom Uproc" },
    "label": { type : String, label: "Libellé Uproc" },
    "status": { type : String, label: "Status UPR" }
});
Run Code Online (Sandbox Code Playgroud)

出于某种原因,我忽略了,即使SimpleSchema似乎很好地实现了,我也不能在Mongo.Collection上使用attachSchema属性.

这是我的代码:

let repo_collection = new Mongo.Collection('repository');
export const Repository = new MongoObservable.Collection<Uproc>('repo_collection');
repo_collection.attachSchema( UprocSchema );
Run Code Online (Sandbox Code Playgroud)

这是我的错误消息:

"Collection <{}>"类型中不存在属性"attachSchema".

TypeError:repo_collection.attachSchema不是函数

simple-schema angular2-meteor

1
推荐指数
1
解决办法
1016
查看次数

标签 统计

angular2-meteor ×1

simple-schema ×1