异常信息

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. 响应式设计工具网站mydevice.io

    1.网址 https://mydevice.io/ 2.使用 在mydevice.io上有常见智能手机,PC电脑的尺寸.

  2. android 开机自启动的几种方法,监听不到RECEIVE_BOOT_COMPLETED的处理办法

    第一种:  监控RECEIVE_BOOT_COMPLETED,即开机启动事件 另外一种: 监控sd卡mount事件  开机总会扫描sd卡吧? 监控sd卡事件也有类似开机启动效果.特别app安装在sd卡 ...

  3. POJ 3221 Diamond Puzzle(BFS)

    Description A diamond puzzle is played on a tessellated hexagon like the one shown in Figure 1 below ...

  4. Cocos2d-x3.2 LayerMultiplex使用说明

    LayerMultiplex是层的控制器类 使用例如以下 LayerMultiplexTest.h // // LayerMultiplexTest.h // cpp4 // // Created b ...

  5. 04-2winPE里面下载系统并安装系统教程

    winPE里面下载系统并安装系统教程 首先需要注意的是,你已经使用 装机助理 工具制作好U盘启动盘,通过电脑功能键进入PE界面(不同型号的电脑进入PE界面的功能键不同,根据不同搜索属于她的功能键): ...

  6. Linux LVM逻辑卷配置过程详解(创建、扩展、缩减、删除、卸载、快照创建)(未完)

    转:http://blog.csdn.net/xuanfeng407/article/details/51465472

  7. Linux Tools

    WinSCP  http://winscp.net/eng/download.php Xshell 5

  8. Atitit.收银机小票打印功能的设计  java php c#.net版本

    Atitit.收银机小票打印功能的设计  java php c#.net版本 1. 1. 打印方式有4种:1 1.1. 1.1. 一是不经过任何修改,直接调用javascript中的window.pr ...

  9. SQL——使用游标进行遍历

    前两天一个同事大叔问了这样一个问题,他要对表做个类似foreach的效果,问我怎么搞.我想了想,就拿游标回答他,当时事实上也没用过数据库中的游标,可是曾经用过ADO里面的,感觉应该几乎相同. 今天闲下 ...

  10. nginx 模块简介

    nginx模块一般分为5类:核心模块.标准http模块.可选http模块.邮件服务模块.第三方模块. 其中核心模块和标准http模块在快速编译之后就包含在了nginx中. 主要看一下核心模块.标准ht ...