我有如下的这么一个数据结构,这是 mongo 一张表里的一条记录. 每条记录下面有一些特定的 key 每个 key 对应的是一个 dict. 想像 mongo 大佬请教一下 假设我每条记录的 key 都是一样的,都是 task_uuid、UNION、SUBQUERY_REP、DML_SORT
抱拳(请各位 mongo 大佬指教
{ "_id" : ObjectId("1321321321421"), "UNION" : { "infomation" : { "sql_id" : "321321432", "sql_text" : "select count(*) count1 from", "obj_name" : null, "plan" : [] }, "infomation" : { "sql_id" : "43zcf95vbk32143vjx", "sql_text" : "from appuser1.objectname1 union\nselect count(*) count19 from appuser1.objectname1 ", "obj_name" : null, "plan" : [] }, "scores" : 4.0 }, "SUBQUERY_REP" : {}, "DML_SORT" : {}, "task_uuid" : "09ae20b4-64e8-11e8-b712-f45c832138f3b", }
![]() | 1 xkeyideal 2018-06-01 08:58:08 +08:00 mongo 也有 group 语句的,那么 map 的指定信息,不是 bson.M{"UNION.information":"xxx"}, 卧槽,你这样例数据有问题吧,map 怎么能有两个同样的 key |
3 nightstart OP @xkeyideal 抱歉抱歉我的锅 2 我修改了一些信息 没想到两个都写了 information |
![]() | 4 xkeyideal 2018-06-01 11:07:11 +08:00 { "_id" : ObjectId("1321321321421"), "UNION" : { "321321432" : { "sql_id" : "321321432", "sql_text" : "select count(*) count1 from", "obj_name" : null, "plan" : [] }, "43zcf95vbk32143vjx" : { "sql_id" : "43zcf95vbk32143vjx", "sql_text" : "from appuser1.objectname1 union\nselect count(*) count19 from appuser1.objectname1 ", "obj_name" : null, "plan" : [] }, "scores" : 4.0 }, "SUBQUERY_REP" : {}, "DML_SORT" : {}, "task_uuid" : "09ae20b4-64e8-11e8-b712-f45c832138f3b", } 把存储结构改成这样 |