【问题标题】:Meteor: Uncaught TypeError: Meteor.users is not a functionMeteor: Uncaught TypeError: Meteor.users 不是函数
【发布时间】:2017-03-22 15:10:47
【问题描述】:

在运行 Meteor 的网站上。通过 Google chrome 控制台我可以运行:

Meteor.user()

这将返回我登录帐户所需的内容。

当我跑步时

Meteor.users()

返回

VM596:1 Uncaught TypeError: Meteor.users is not a function

有人可以建议吗?

【问题讨论】:

    标签: meteor meteor-accounts


    【解决方案1】:

    Meteor.users 是一个包含所有用户文档的 mongo 集合。所以你不能做 Meteor.users()。相反,您可以使用

    在其中找到文档
    Meteor.users.find({}).fetch();
    

    更多信息可以看meteor docs

    【讨论】:

    • 谢谢 - 试过了,但它只是把我带回来而不是其他人。
    • 我听不懂你。答案有帮助吗??
    • 你写的代码只是带回了一个用户而不是系统中的每个人
    • 您只能访问服务器端的所有用户。如果您需要客户端的所有用户,您需要从服务器发布这些数据,然后订阅它。
    • 您是否删除了自动发布??
    【解决方案2】:

    您必须在 package.js 中包含以下包才能让 Meteor.users 运行

    accounts-password@1.3.3

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2020-04-29
      • 2019-11-06
      • 2017-09-18
      • 2020-06-05
      • 1970-01-01
      • 2017-06-24
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多