【问题标题】:meteor publish composite does not流星发布复合不
【发布时间】:2017-05-12 07:00:55
【问题描述】:

我在尝试使用 meteor-publish-composite 时遇到问题。我看到这个页面https://github.com/englue/meteor-publish-composite 并在我的流星项目中执行以下代码:

meteor add reywood:publish-composite

我像这样创建发布复合函数:

import { Meteor } from 'meteor/meteor';
import { Categories } from '../../../../both/collections/administration/category.collection';
import { Structures } from '../../../../both/collections/administration/structure.collection';

//Meteor.publish('categories', () => Categories.find());

Meteor.publishComposite('categoriesWithStructures', {
    find: () => {
        return Categories.collection.find();
    },
    children: [{
        find:(category) => {
            console.log(category);
            return Structures.collection.find({_id: category.structure});
        }
    }]
});

但是当我初始化项目时,在控制台中我看到了消息:

Property 'publishComposite' does not exist on type 'typeof Meteor'

在.meteor/packages 文件中添加了流星模块

angular2-compilers
accounts-password
msavin:mongol
reywood:publish-composite

我的流星项目使用Angular2。

我将不胜感激。问候。

【问题讨论】:

  • 这段代码是否在服务器上运行? .publishComposite() 在客户端将不可用。
  • 是的,正在服务器上运行

标签: meteor angular-meteor


【解决方案1】:

我也有同样的问题。

我的解决方案看起来像 Meteor["publishComposite"] (...) 代替 Meteor.publishComposite (...)

我也在使用流星的打字稿,我认为它不是赌注组合(还)。

【讨论】:

    猜你喜欢
    • 2015-07-24
    • 2015-02-23
    • 2014-09-24
    • 2014-05-04
    • 1970-01-01
    • 1970-01-01
    • 2018-12-18
    • 2018-12-26
    相关资源
    最近更新 更多