【问题标题】:CouchDB-Why my rerduce is always coming as false ? I am not able to reduce anything properlyCouchDB-为什么我的减少总是假的?我无法正确减少任何东西
【发布时间】:2015-06-14 12:47:18
【问题描述】:

我是 CouchDB 的新手。我有一个 9 GB 的数据集加载到我的 couchdb 中。我能够正确映射所有内容。但是我不能使用写在 reduce 列中的代码来减少任何结果。当我尝试日志时,日志显示 rereduce 值为 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 操作!!! :(

截图,

请帮帮我!!!

【问题讨论】:

    标签: mapreduce couchdb couchdb-futon


    【解决方案1】:

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

    grouping下拉列表更改为none

    查看CouchdDB's wiki 了解有关分组的更多详细信息。

    【讨论】:

    • 感谢您的回答。我现在明白了:)
    猜你喜欢
    • 2017-02-21
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2016-08-22
    • 2018-10-18
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多