非常简单,没有任何类型的配置中检索数据),我使用命令use meteor
切换到分贝流星随后进入一些基本数据,以测试:流星无法从MongoDB的
j = { name: "mongo" }
k = { x: 3 }
db.testData.insert(j)
db.testData.insert(k)
我检查,并通过输入得到的结果:db.testData.find()
这里是我的流星代码提供了MongoDB的访问只需要在客户端上:
if (Meteor.isClient) {
Template.hello.greeting = function() {
return "Welcome to test.";
};
Template.hello.events({
'click input' : function() {
// template data, if any, is available in 'this'
if (typeof console !== 'undefined')
console.log("You pressed the button");
}
});
Documents = new Meteor.Collection('testData');
var document = Documents.find();
console.log(document);
var documentCbResults = Documents.find(function(err, items) {
console.log(err);
console.log(items);
});
}
在浏览器上的检查和基于日志,它说undefined
。从mongodb中检索数据并显示到客户端控制台,我没有成功。
我错过了什么?