// in server.js
Meteor.publish("directory", function () {
return Meteor.users.find({}, {fields: {emails: 1, profile: 1}});
});
// in client.js
Meteor.subscribe("directory");
Run Code Online (Sandbox Code Playgroud)
我现在想从客户端查询目录列表,就像directory.findOne()从浏览器控制台查询一样.//测试目的
执行directory=Meteor.subscribe('directory')/ directory=Meteor.Collection('directory')执行directory.findOne()不起作用,但是当我这样做directory=new Meteor.Collection('directory')并且返回undefined时我打赌它在服务器上创建一个我不喜欢的mongo集合,因为USER集合已经存在并且它指向一个新的集合而不是USER采集.
注意:我不想弄乱Meteor.users集合如何处理它的功能......我只想使用一个不同的句柄从它中检索一些特定的数据,该句柄只返回指定的字段而不是覆盖它的默认函数. .
例如:
Meteor.users.findOne() // will return the currentLoggedIn users data
directory.findOne() // will return different fields taken from Meteor.users collection.
Run Code Online (Sandbox Code Playgroud) 我知道这是一个非常愚蠢的问题,但在我重新格式化我的闪存驱动器(它说它已损坏并需要格式化以便我这样做)并使用恢复软件恢复其中的文件后,我得到了所有文件背部.
然而,我的一些php,css和js文件的内容转化成这样的:
494e 4458 2800 0900 064b 3605 0000 0000
1a00 0000 0000 0000 2800 0000 2008 0000
e80f 0000 0000 0000 0200 6900 0000 0100
0000 0000 7400 cd01 0000 0000 0000 0000
bea9 0000 0000 0100 7000 5a00 0000 0000
f915 0000 0000 0100 a09f 1e22 036b cd01
Run Code Online (Sandbox Code Playgroud)
反正有没有像以前一样恢复我的文件?
一切正常,除了在做了流星更新0.8.3并且想出了那个错误.任何形式的帮助将不胜感激.