我有一个名为的模板qa
,在其中我使用了一个名为 的助手question
,它将text
根据_id
属性获取我的文档的字段。
Template.qa.helpers({
question: function () {
return Questions.find({_id: 24}).fetch()[0].text;
}
});
这对所有_id
值都适用,除非我使用_id: 0
,然后什么都不返回。我db.questions.find({_id: 0})
在 minimongo 控制台上运行,它确实返回了一个文档。
{ "_id" : 0, "author" : 0, "create" : "2014-12-22T13:26:23.038Z", "liked" : [ ], "range" : "", "text" : "I want to get this text", "update" : "2014-12-22T13:26:23.038Z", "version" : 1 }
我不能_id: 0
在collection.find()
流星中使用吗?
澄清:我不想返回除 之外的所有字段_id
,我想根据_id
值查找/选择。_id
但如果为 0则不起作用。