Php MongoDB MapReduce映射函数中的replace()
我正在尝试在MongoDB mapReduce中进行模式匹配和替换。我正在映射数据库中推特的来源。得到重复的结果,比如Php MongoDB MapReduce映射函数中的replace(),php,mongodb,mapreduce,Php,Mongodb,Mapreduce,我正在尝试在MongoDB mapReduce中进行模式匹配和替换。我正在映射数据库中推特的来源。得到重复的结果,比如 1 - web has 38867 2 - <a href="http://www.tweetdeck.com" rel="nofollow">TweetDeck</a> has 23873 3 - <a href="http://www.hootsuite.com" rel="nofollow">HootSuite</a> ha
1 - web has 38867
2 - <a href="http://www.tweetdeck.com" rel="nofollow">TweetDeck</a> has 23873
3 - <a href="http://www.hootsuite.com" rel="nofollow">HootSuite</a> has 10696
4 - <a href="http://twitterfeed.com" rel="nofollow">twitterfeed</a> has 9562
5 - <a href="http://twitter.com/#!/download/iphone" rel="nofollow">Twitter for iPhone</a> has 6818
6 - <a href="http://www.echofon.com/" rel="nofollow">Echofon</a> has 5869
7 - <a href="http://www.tweetdeck.com/" rel="nofollow">TweetDeck</a> has 5497
结果是
(
[assertion] => couldn't compile code for: _map
[assertionCode] => 13598
[errmsg] => db assertion failure
[ok] => 0
)
通常,最简单的测试方法是从shell运行M/R。这将有助于编译b/c,shell可以识别错误的语法 如果我使用我的“人工编译”技能,以下看起来是错误的
s = s.replace(/\/\"/i,"/"");
您正在转义/”
,并将其替换为/
?请查看“/”
,这似乎是一个太多的双引号
s = s.replace(/\/\"/i,"/"");