Meteor js客户端直接连接到mongodb

时间:2022-02-19 16:37:53

Using meteor js on the client side and from this condition: if (Meteor.isClient), is it possible to connect to a mongodb collection directly?

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

If so, how can I do that?

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

1 个解决方案

#1


1  

Well, that's what Meteor is all about! See the documentation. Simple example:

嗯,这就是Meteor的意义所在!请参阅文档。简单的例子:

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

#1


1  

Well, that's what Meteor is all about! See the documentation. Simple example:

嗯,这就是Meteor的意义所在!请参阅文档。简单的例子:

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