流星集合文件夹结构

时间:2015-02-18 17:31:57

标签: javascript mongodb meteor

official Meteor doc说:

  

集合/#< - 集合和方法的定义(可以   是模特)。

在我的数据库中,我有一个集合universities。所以在我的Collections文件夹中我有university.js 如何实现集合方法,例如find()?我不希望我的index.js中包含所有代码。我知道我可以使用Meteor.methods和Meteor.call,但这是用于客户端 - 服务器调用。

1 个答案:

答案 0 :(得分:0)

也许创建这样的函数。在你想要的任何文件夹/lib/collections可以选择。

  

例如find()

function findMethod(){
  return Collection.find();
}

并随意使用它。

var finde = findMethod();
相关问题