流星合集文件夹结构
Meteor collection folder structure
Collections/# <- definitions of collections and methods on them (could
be models).
在我的数据库中有一个集合 universities
。所以在我的 Collections 文件夹中我有 university.js
.
如何在集合上实现方法,例如find()
?我不想在我的 index.js
中包含所有代码。我知道我可以有 Meteor.methods 和 Meteor.call 但那是用于客户端 - 服务器调用。
也许创建一个这样的函数。在任何你想要的文件夹上 /lib/collections
可能是一个选项。
for example find()
function findMethod(){
return Collection.find();
}
随心所欲地使用它。
var finde = findMethod();
Collections/# <- definitions of collections and methods on them (could be models).
在我的数据库中有一个集合 universities
。所以在我的 Collections 文件夹中我有 university.js
.
如何在集合上实现方法,例如find()
?我不想在我的 index.js
中包含所有代码。我知道我可以有 Meteor.methods 和 Meteor.call 但那是用于客户端 - 服务器调用。
也许创建一个这样的函数。在任何你想要的文件夹上 /lib/collections
可能是一个选项。
for example find()
function findMethod(){
return Collection.find();
}
随心所欲地使用它。
var finde = findMethod();