MongoDb:密钥名中的空格?

MongoDb:密钥名中的空格?,mongodb,mapreduce,Mongodb,Mapreduce,我有一点小问题,这让我连续几天把头撞在墙上 考虑以下文件: { '_id': '5d7de43ac7baaa0ff2c4ae2bd000518a', 'Some Complex Name': { 'data': { 'simpleKey': [ { 'name': 'Bob', 'age': 30

我有一点小问题,这让我连续几天把头撞在墙上

考虑以下文件:

{
    '_id': '5d7de43ac7baaa0ff2c4ae2bd000518a',
    'Some Complex Name': {
        'data': {
            'simpleKey': [
                {
                    'name': 'Bob',
                    'age': 30
                },
                {
                    'name': 'Sam',
                    'age': 31
                },
                {
                    'name': 'George',
                    'age': 20
                }
            ]
        }
    }
}
在我对JavaScript的理解中,我了解到我将以以下方式引用“某个复杂名称”(在
map
函数的范围内):

在此基础上,我将能够访问以下名称:

var names = [];
for (var i in this['Some Complex Name'].data.simpleKey) {
    names.push(this['Some Complex Name'].data.simpleKey[i].name);
}
emit(this._id, names);
不幸的是,我在这一点上错了,因为我得到了这样一个错误

        "errmsg" : "exception: map invoke failed: JS Error: TypeError: this['Some Complex Name'] has no properties nofile_b:2"
因此,我的问题是:我如何/正确/访问“某个复杂名称”键

另外,还需要一些文档来解释这一点


谢谢

事实上,我刚刚找到了答案,这正是我所怀疑的

是同一个问题,事实证明,我需要过滤我的查询,以确保我处理的文档中存在一些复杂的名称。这是通过
查询
mapReduce
完成的

        "errmsg" : "exception: map invoke failed: JS Error: TypeError: this['Some Complex Name'] has no properties nofile_b:2"