【问题标题】:Meteor js client side connect directly to mongodbMeteor js客户端直接连接mongodb
【发布时间】:2014-02-18 02:52:38
【问题描述】:

在客户端使用meteor js,从这个条件:if (Meteor.isClient),是否可以直接连接到mongodb集合?

如果是这样,我该怎么做?

【问题讨论】:

    标签: javascript node.js mongodb meteor


    【解决方案1】:

    嗯,这就是 Meteor 的全部意义所在!见the documentation。简单例子:

    if(Meteor.isClient) {
      Documents = new Meteor.Collection('documents');
      var document = Documents.findOne({title: 'Example'});
    }
    

    【讨论】:

      猜你喜欢
      • 2014-03-28
      • 2015-07-25
      • 1970-01-01
      • 2014-03-17
      • 2011-09-12
      • 1970-01-01
      • 2012-04-14
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多