Key must not contain . error in pymongo

前端 未结 3 640
Happy的楠姐
Happy的楠姐 2021-01-19 06:33

I am trying to get the output of serverStatus command via pymongo and then insert it into a mongodb collection. Here is the dictionary

{u\'metrics\': {u\'getLa

3条回答
  •  隐瞒了意图╮
    2021-01-19 07:03

    In the 14th line:

    u'.': {u'timeAcquiringMicros': {u'R': 218733L, u'W': 30803L}, u'timeLockedMicros': {u'R': 311478L, u'W': 145679L}}}   
    

    For future safety, iterate through the keys, replace '.'s with '_' or something, and then perform a write.

提交回复
热议问题