Meteor收集文件夹结构

Meteor collection folder structure

本文关键字:结构 文件夹 Meteor      更新时间:2024-01-01

Meteor官方文档显示:

集合/#<-集合的定义及其方法(可以be模型)。

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

也许可以创建这样的函数。/lib/collections可以是一个选项。

例如find()

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

想用什么就用什么。

var finde = findMethod();