0

こんにちは、コレクションに次のドキュメントがありました

{
 "_id" : ObjectId("5236b303e4b074ca9f4ed453")
 "Commands":{
    "netstat -tulpn":"Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address               Foreign Address             State       PID/Program name   
tcp        0      0 0.0.0.0:3306                0.0.0.0:*                   LISTEN      2285/mysqld         
tcp        0      0 0.0.0.0:63342               0.0.0.0:*                   LISTEN      3992/java           
tcp        0      0 0.0.0.0:33359               0.0.0.0:*                   LISTEN      1913/rpc.statd      
tcp        0      0 0.0.0.0:111                 0.0.0.0:*                   LISTEN      1794/rpcbind        
tcp        0      0 0.0.0.0:3216                0.0.0.0:*                   LISTEN      3485/skype          
tcp        0      0 0.0.0.0:28017               0.0.0.0:*                   LISTEN      3821/mongod         
tcp        0      0 192.168.122.1:53            0.0.0.0:*                   LISTEN      2628/dnsmasq        
tcp        0      0 0.0.0.0:22                  0.0.0.0:*                   LISTEN      2147/sshd           
tcp        0      0 127.0.0.1:44567             0.0.0.0:*                   LISTEN      11436/GoogleTalkPlu 
tcp        0      0 127.0.0.1:631               0.0.0.0:*                   LISTEN      1987/cupsd          
tcp        0      0 127.0.0.1:6942              0.0.0.0:*                   LISTEN      3992/java           
tcp        0      0 127.0.0.1:55777             0.0.0.0:*                   LISTEN      11436/GoogleTalkPlu 
tcp        0      0 127.0.0.1:6311              0.0.0.0:*                   LISTEN      5088/Rserve         
tcp        0      0 0.0.0.0:27017               0.0.0.0:*                   LISTEN      3821/mongod         
tcp        0      0 127.0.0.1:9001              0.0.0.0:*                   LISTEN      2382/java           
tcp        0      0 :::111                      :::*                        LISTEN      1794/rpcbind        
tcp        0      0 :::22                       :::*                        LISTEN      2147/sshd           
tcp        0      0 :::36441                    :::*                        LISTEN      1913/rpc.statd      
udp        0      0 0.0.0.0:111                 0.0.0.0:*                               1794/rpcbind        
udp        0      0 127.0.0.1:39287             0.0.0.0:*                               3485/skype          
udp        0      0 0.0.0.0:631                 0.0.0.0:*                               1987/cupsd          
udp        0      0 0.0.0.0:3216                0.0.0.0:*                               3485/skype          
udp        0      0 0.0.0.0:52777               0.0.0.0:*                               1913/rpc.statd      
udp        0      0 0.0.0.0:817                 0.0.0.0:*                               1913/rpc.statd      
udp        0      0 192.168.122.1:53            0.0.0.0:*                               2628/dnsmasq        
udp        0      0 0.0.0.0:697                 0.0.0.0:*                               1794/rpcbind        
udp        0      0 0.0.0.0:67                  0.0.0.0:*                               2628/dnsmasq        
udp        0      0 0.0.0.0:68                  0.0.0.0:*                               18609/dhclient      
udp        0      0 :::111                      :::*                                    1794/rpcbind        
udp        0      0 :::697                      :::*                                    1794/rpcbind        
udp        0      0 :::47419                    :::*                                    1913/rpc.statd    "
   }
}

私のマップ削減コードは以下のとおりです

 var mapfunction = function(){
  var key,values;
      for (var i in this.Commands) {
         key = {id:this._id};
             values = {commands:this.Commands};
             emit(key,values);
    }
 }
 var reducefunction = function(key,values){
 var reduced = {netstat:[]};
  for(var i =0 ; i< values.length;i++){
        reduced.netstat = values[i].commands.netstat -tulpn;
     }
     return reduced;
   }
 db.collectioname.mapReduce(mapfunction,reducefunction,{
 out: {replace:"final"}
 })

このコード mongoshell を実行すると、次のエラーが表示されます。' (5 行目)", "コード": 16722, "OK": 0 }

2 つの単語にスペースを含むキーで mongo マップが縮小されなかった理由を誰か教えてもらえますか? この問題を解決する方法を知っている人はいますか?

4

1 に答える 1