【发布时间】:2015-05-20 04:24:24
【问题描述】:
刚开始玩 Meteor,我希望将 meteor-simple-schema 与 meteor-pages 一起使用
原理很简单,我只是在玩他们提供的示例todos 应用程序,并想添加无限滚动以加载更多待办事项。但我不能让两者都工作。
这是我的默认代码meteor-simple-schema
Todos = new Meteor.Collection('todos', {});
Schema = {};
Todos.attachSchema(new SimpleSchema({
text: {
type: String,
label: "Name",
max: 200,
min: 2
},
createdAt: {
type: Date,
label: "Created",
optional: false
},
creatorId: {
type: String,
label: "Creator",
optional: false
},
done: {
type: Boolean,
defaultValue: false,
label: "Done?",
optional: true
}
}));
然后我将new Meteor.Collection('todos') 切换为new Meteor.Pages('todos') 甚至new Meteor.Pagination('todos')
但是架构会产生错误。我怎样才能使两者都起作用?
以下是错误:
W20150317-22:47:23.197(1)? (STDERR) ~/.meteor/packages/meteor-tool/.1.0.41.azxhr5++os.osx.x86_64+web.browser+web.cordova/meteor-tool-os.osx.x86_64/dev_bundle/server-lib/node_modules/fibers/future.js:173
W20150317-22:47:23.197(1)? (STDERR) throw(ex);
W20150317-22:47:23.197(1)? (STDERR) ^
W20150317-22:47:23.199(1)? (STDERR) TypeError: Object #<Pages> has no method 'attachSchema'
W20150317-22:47:23.200(1)? (STDERR) at app/collections/todos.js:25:7
W20150317-22:47:23.200(1)? (STDERR) at app/collections/todos.js:60:3
【问题讨论】:
标签: javascript node.js mongodb meteor pagination