异常信息

repl_test:PRIMARY> db.0917order_totals_b.find()
2018-09-28T15:13:03.992+0800 E QUERY [main] SyntaxError: identifier starts immediately after numeric literal @(shell):1:2
repl_test:PRIMARY> db.0917order_totals_b.find({})
2018-09-28T15:13:13.464+0800 E QUERY [main] SyntaxError: identifier starts immediately after numeric literal @(shell):1:2

情景还原

【使用mapReduce统计指定时间戳区间的交易行为总数】

聚合,统计0917消费金额总和
Aggregation — MongoDB Manual https://docs.mongodb.com/manual/aggregation/
db.accounting_center_orders.mapReduce(function(){emit(this.service_id,this.val)},function(key,values){return Array.sum(values)},{query:{create_timestamp:{$lt:1537200000,$gt:1537113600}},out:"0917order_totals"})
{
"result" : "0917order_totals",
"timeMillis" : 978,
"counts" : {
"input" : 78010,
"emit" : 78010,
"reduce" : 2828,
"output" : 14
},
"ok" : 1
}
结果新建集合
repl_test:PRIMARY> show collections
0917order_totals
Analyse_consume
db.accounting_center_orders.mapReduce(function(){emit(this.service_id,this.val)},function(key,values){return Array.sum(values)},{query:{create_timestamp:{$lt:1537200000,$gt:1537113600}}})
mapReduce 需要指明结果的输出集合名
repl_test:PRIMARY> db.accounting_center_orders.mapReduce(function(){emit(this.service_id,this.val)},function(key,values){return Array.sum(values)},{query:{create_timestamp:{$lt:1537200000,$gt:1537113600}}})
2018-09-28T15:00:07.163+0800 E QUERY [main] TypeError: c.out is undefined :
DBCollection.prototype.mapReduce@src/mongo/shell/collection.js:1401:1
@(shell):1:1
 
 
查询其他集合返回预期信息
 

repl_test:PRIMARY> db.0917order_totals_b.find()
2018-09-28T15:16:25.627+0800 E QUERY [main] SyntaxError: identifier starts immediately after numeric literal @(shell):1:2

2节点主备复制集

[root@e ~]# cat /usr/local/mongodb/conf/mongod.conf
bind_ip=10.14.14.12
port=27017
dbpath=/mnt/mongodb_data/data
logpath=/mnt/mongodb_data/log/mongod.log
pidfilepath=/usr/local/mongodb/mongo.pid
fork=true
logappend=true
shardsvr=true
directoryperdb=true
replSet=repl_test
keyFile=/usr/local/mongodb/conf/keyFile
[root@e ~]#

删除集合报同样错误

repl_test:PRIMARY> db.0917order_totals.drop()
2018-09-28T15:27:20.825+0800 E QUERY [main] SyntaxError: identifier starts immediately after numeric literal @(shell):1:2
repl_test:PRIMARY>

变换命名

repl_test:PRIMARY> db.accounting_center_orders.mapReduce(function(){emit(this.service_id,this.val)},function(key,values){return Array.sum(values)},{query:{create_timestamp:{$lt:1537200000,$gt:1537113600}},out:"order_totalsMR"})
{
"result" : "order_totalsMR",
"timeMillis" : 905,
"counts" : {
"input" : 78010,
"emit" : 78010,
"reduce" : 2828,
"output" : 14
},
"ok" : 1
}
repl_test:PRIMARY> show collections

order_totalsMR

repl_test:PRIMARY> db.order_totalsMR.find()
{ "_id" : 0, "value" : 2472975 }
{ "_id" : 1, "value" : -316177.25 }
{ "_id" : 2, "value" : -211655 }
{ "_id" : 4, "value" : -189450 }
{ "_id" : 7, "value" : -7750 }
{ "_id" : 8, "value" : -194385 }
{ "_id" : 10, "value" : -10000 }
{ "_id" : 11, "value" : -184954.40000000005 }
{ "_id" : 13, "value" : -35050 }
{ "_id" : 16, "value" : -30000 }
{ "_id" : 19, "value" : -6000 }
{ "_id" : 20, "value" : -1329.9999999999998 }
{ "_id" : 21, "value" : -361475 }
{ "_id" : 22, "value" : -600 }
repl_test:PRIMARY>

得到预期输入

【 集合命名规范 :英文字母开头】

 
 
 
 

E QUERY [main] SyntaxError: identifier starts immediately after numeric literal mongodb mapReduce 异常分析 集合命名规范的更多相关文章

  1. Js 抱错:::SyntaxError: identifier starts immediately after numeric literal

    SyntaxError: identifier starts immediately after numeric literal 今天写了个onclick()方法,有这样的一个变量4028b88161 ...

  2. 错误:SyntaxError: identifier starts immediately after numeric literal

    转载:http://blog.csdn.net/shalousun/article/details/39995443在用JavaScript时,当你使用一个字符传作为函数的参数常常会看到语法错误,在f ...

  3. js 传参报错 参数含有数字、字母组合的字符串SyntaxError: identifier starts immediately after numeric literal

    报错的意思是标识符以数字开头,这是因为js是弱类型的语言当发现第一个数字是就自动转化为数字类型的但是其中还含有字符所以报了错,‘ 报错的原因是因为我们想传的字符串,但是js却当成数字,所以需要给传的参 ...

  4. SyntaxError:identifier starts immediately after numeric literal

    1.错误描写叙述 2.错误原因 因为在改动方法传參的过程,须要传个id,可是这个id是字符串类型,传入的是数值型 3.解决的方法 在传參时,须要加入"",变成字符串类型 User. ...

  5. 使用onclick报SyntaxError: identifier starts immediately after numeric literal

    少了‘’ 错误 onclick="onlineWatch(${row.title})" 正确 onclick="onlineWatch('${row.title}')&q ...

  6. jQuery 事件函数传参异常identifier starts immediately after numeric literal

    问题情境: var arr=[aabbcc,112233]; var html = ""; for(var i =0;i<arr.length;i++){ html += ' ...

  7. javascript中出现identifier starts immediately after numeric literal错误原因以及解决方法

    javascript遇到参数是字符型和数字型组合的参数就会出现这种错误,例如alert(1);可以正確輸出alert(str);就會報錯alert("str");可以正確輸出.

  8. org.hibernate.NonUniqueObjectException: a different object with the same identifier value was already associated with the session异常解决办法

    org.hibernate.NonUniqueObjectException: a different object with the same identifier value was alread ...

  9. presto——java.sql.SQLException: Error executing query与javax.net.ssl.SSLException: Unrecognized SSL message, plaintext connection?异常问题

    使用presto的时候以mysql为presto的数据源 安装的presto是0.95版本:使用的presto-jdbc是0.202的,这里使用jdbc去访问时候,connection可以链接成功,但 ...

随机推荐

  1. PHP怎么实现站点保存快捷方式

    PHP怎么实现站点保存快捷方式 <?php $Shortcut = "[InternetShortcut] URL=http://blog.csdn.net/phpfenghuo/ I ...

  2. UIAlertViewController 2

    iOS 8的新特性之一就是让接口更有适应性.更灵活,因此许多视图控制器的实现方式发生了巨大的变化.全新的UIPresentationController在实现视图控制器间的过渡动画效果和自适应设备尺寸 ...

  3. 改变Prompt默认路径,Change Default Visual Studio Command Prompt Location

    在项目中经常需要使用 Visual Studio Command Prompt编译项目,每次启动时都是默认进入 C:\windows\system32> 目录, 需要cd切换路径,如果把Visu ...

  4. asp.net core mvc视频A:笔记6-1.应用发布与部署

    显示:直接使用上节课的项目 一.使用vs发布应用 这里选择发布到文件夹,当然你可以选择其他的发布方式 部署模式:(我的VS里没有这个配置,不知道为啥...视频里有) 1.框架依赖:选择此模式,发布后需 ...

  5. Python 解码 Unicode 转义字符串 (转)

    其实,这里要讨论的内容是针对 Python2 的,实际上也是 Python2 中让人头疼的编码问题,而 Python3 则好处理得多. 先来看看例子: >>> s = "我 ...

  6. Atitit.js this错误指向window的解决方案

    Atitit.js this错误指向window的解决方案 1.1. 出现地点and解决之道1 1.2. call,apply和bind这三个方法2 1.2.1. Function.prototype ...

  7. 批量分发SSH秘钥

    #!/usr/bin/expect # filename: distribute_key.expif [ $argc != 2 ]{ send_user "usage: expect exp ...

  8. jquery的基本api

    本文整理了一些主要的jQuery API,其中包括jQuery 核心函数和方法.jQuery属性参考手册.jQuery CSS操作.jQuery选择器.jQuery文档操作.jQuery筛选操作.jQ ...

  9. java中过滤四字节字符

    private static final String FOUR_BYTE_FILTER = "[\\ud800\\udc00-\\udbff\\udfff\\ud800-\\udfff]& ...

  10. iOS大文件分片上传和断点续传

    总结一下大文件分片上传和断点续传的问题.因为文件过大(比如1G以上),必须要考虑上传过程网络中断的情况.http的网络请求中本身就已经具备了分片上传功能,当传输的文件比较大时,http协议自动会将文件 ...