使用 MeteorJS 堆栈,如何使用 object 的 ID Object 的 return 属性?

Using the MeteorJS stack, how do I return properties of an Object using the id of that object?

我是 MeteorJS 的新手(2 天),所以如果这是基础知识,我深表歉意。这是我的 collection 和插入语句:

Posts = new Mongo.Collection("posts");

...Posts.insert({
        title: title,
        body: body,
        createdAt: new Date(),
        userId: Meteor.userId()
    });
...

我正在尝试获取标题,并最终获取具有特定 ID(用户点击查看)的博客 post 的其余详细信息:

console.log(Posts.find({_id: this._id}).fetch('title'));

这是当前正在输出的内容:

 [Object]0: Object_id: "a6sxfuj2fzhjrLHwb"body: "Get a life Lebrec!"createdAt: Wed Apr 13 2016 22:14:17 GMT-0400 (Eastern Daylight Time)title: "Lebrec makes a fifth blog post."userId: "ST4g5DHWFL3wXZLdx"__proto__: Objectlength: 1__proto__: Array[0]

我得到了整个 object,以及其他东西。在这种情况下,我只是在寻找要输出到控制台的标题 "Lebrec makes a fifth blog post."。最终目标是在模式中显示标题、日期、用户的电子邮件以及 post 的 body。模态已经在运行。提前致谢!

common mistakes 的 "Find and Fetch" 部分开始。这是您要查找的内容:

console.log(Posts.findOne({_id: this._id}).title);