【发布时间】:2015-04-10 18:49:32
【问题描述】:
我将给出一个代码示例来描述我的问题:
var id = Collection.insert({
name: 'Charles Darwin',
likes: 1
});
var someVariable = 'name';
Collection.findOne(id).name // This returns 'Charles Darwin', but how do I use someVariable to get the same result?
Collection.findOne(id).someVariable // This will certainly not work, but what is the right way to do it?
【问题讨论】:
-
不要忘记点击投票箭头附近的符号来接受答案。恭喜您提出第一个问题! (哦,顺便说一句,也试着从代码中提出问题,以使其非常清楚)。
标签: javascript node.js mongodb meteor