[英]Meteor collection folder structure
集合/#< - 集合和方法的定义(可以是模型)。
在我的数据库中,我有一个收藏universities
。 所以在我的Collections文件夹中我有university.js
。
如何实现集合方法,例如find()
? 我不希望我的index.js
包含所有代码。 我知道我可以使用Meteor.methods和Meteor.call,但这是用于客户端 - 服务器调用。
也许创建这样的功能。 在你想要的任何文件夹上/lib/collections
可以是一个选项。
例如find()
function findMethod(){
return Collection.find();
}
并随心所欲地使用它。
var finde = findMethod();
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.