CouchDB-为什么我的rerduce总是假的?我无法正常减少任何事情

时间:2015-06-14 12:47:18

标签: mapreduce couchdb couchdb-futon

我是CouchDB的新手。我有一个9 GB的数据集加载到我的couchdb。我能够正确地映射一切。但我无法使用reduce列中编写的代码减少任何结果。当我尝试登录时,日志显示将值重新还原为false。在执行Map()时我是否需要做任何特殊操作或者如何设置rereduce值为TRUE?

我的数据样本如下:

{
   "_id": "33d4d945613344f13a3ee92933b160bf",
   "_rev": "1-0425ca93e3aa939dff46dd51c3ab86f2",
   "release": {
       "genres": {
           "genre": "Electronic"
       },
       "status": "Accepted",
       "videos": {
           "video": [
               {
                   "title": "[1995] bola - krak jakomo",
                   "duration": 349,
                   "description": "[1995] bola - krak jakomo",
                   "src": "http://www.youtube.com/watch?v=KrELXoYThpI",
                   "embed": true
               },
               {
                   "title": "Bola - Forcasa 3",
                   "duration": 325,
                   "description": "Bola - Forcasa 3",
                   "src": "http://www.youtube.com/watch?v=Lz9itUo5xtc",
                   "embed": true
               },
               {
                   "title": "Bola (Darrell Fitton) - Metalurg (MV)",
                   "duration": 439,
                   "description": "Bola (Darrell Fitton) - Metalurg (MV)",
                   "src": "http://www.youtube.com/watch?v=_MYpOOMRAeQ",
                   "embed": true
               }
           ]
       },
       "labels": {
           "label": {
               "catno": "SKA005",
               "name": "Skam"
           }
       },
       "companies": "",
       "styles": {
           "style": [
               "Downtempo",
               "Experimental",
               "Ambient"
           ]
       },
       "formats": {
           "format": {
               "text": "",
               "name": "Vinyl",
               "qty": 1,
               "descriptions": {
                   "description": [
                       "12\"",
                       "Limited Edition",
                       "33 ⅓ RPM"
                   ]
               }
           }
       },
       "country": "UK",
       "id": 1928,
       "released": "1995-00-00",
       "artists": {
           "artist": {
               "id": 390,
               "anv": "",
               "name": "Bola",
               "role": "",
               "tracks": "",
               "join": ""
           }
       },
       "title": 1,
       "master_id": 13562,
       "tracklist": {
           "track": [
               {
                   "position": "A1",
                   "duration": "4:33",
                   "title": "Forcasa 3"
               },
               {
                   "position": "A2",
                   "duration": "5:48",
                   "title": "Krak Jakomo"
               },
               {
                   "position": "B1",
                   "duration": "7:50",
                   "title": "Metalurg 2"
               },
               {
                   "position": "B2",
                   "duration": "6:40",
                   "title": "Balloom"
               }
           ]
       },
       "data_quality": "Correct",
       "extraartists": {
           "artist": {
               "id": 388200,
               "anv": "",
               "name": "Paul Solomons",
               "role": "Mastered By",
               "tracks": "",
               "join": ""
           }
       },
       "notes": "Limited to 480 copies.\nA1 is a shorter version than that found on the 'Soup' LP.\nA2 ends in a lock groove."
   }
}

我的目的是计算映射值。我的映射功能如下:

function(doc){ 
if(doc.release)
emit(doc.release.title,1)
}

地图结果显示大约5800个结果

我想在reduce选项卡中使用以下函数来计算: 降低: _count或_sum

它没有给出单个舍入值。即使我不能正确的_count操作! :(

截图,http://s11.postimg.org/lz9ilzhtf/image.png

请帮帮我!!!

1 个答案:

答案 0 :(得分:0)

你得到的是每个标题值>的总和。您想要的是一般值的总和

grouping下拉列表更改为none

检查CouchdDB's wiki以获取有关分组的详细信息。