Uploaded image for project: 'Core Server'
  1. Core Server
  2. SERVER-28647

group() can't handle more than 20000 unique keys

    • Type: Icon: Question Question
    • Resolution: Duplicate
    • Priority: Icon: Major - P3 Major - P3
    • None
    • Affects Version/s: None
    • Component/s: Aggregation Framework
    • Labels:
      None
    • Environment:
      linux

      reducer = Code("""function(obj, prev){prev.count++;}""")
      keys = {'event':True,'type':True}
      conditions = {'event':'video_start'} 
      a = posts.group(key=keys,condition=conditions, initial={"count": 0}, reduce=reducer)
      for i in a:
          print i['type']
          keys = {'sn':True,'clip':True,'type':True}
          conditions = {'event':'video_play_blockend','type':i['type']}
          a = posts.group(key=keys,condition=conditions, initial={"count": 0}, reduce=reducer)
          for t in a:
              if t['count']>=3:
                  print t
          print 1-round(len(a)/i['count'],2),i['type']
          print len(a),i['count'],i['type']
      
      Traceback (most recent call last):
      File "read.py", line 24, in <module>
      a = posts.group(key=keys,condition=conditions, initial={"count": 0}, reduce=reducer)
      File "/usr/lib64/python2.6/site-packages/pymongo/collection.py", line 1941, in group
      collation=collation)["retval"]
      File "/usr/lib64/python2.6/site-packages/pymongo/collection.py", line 232, in _command
      collation=collation)
      File "/usr/lib64/python2.6/site-packages/pymongo/pool.py", line 419, in command
      collation=collation)
      File "/usr/lib64/python2.6/site-packages/pymongo/network.py", line 116, in command
      parse_write_concern_error=parse_write_concern_error)
      File "/usr/lib64/python2.6/site-packages/pymongo/helpers.py", line 210, in _check_command_response
      raise OperationFailure(msg % errmsg, code, response)
      pymongo.errors.OperationFailure: errmsg: "group() can't handle more than 20000 unique keys"
      

            Assignee:
            kelsey.schubert@mongodb.com Kelsey Schubert
            Reporter:
            shenjiawei shenjiawei
            Votes:
            0 Vote for this issue
            Watchers:
            5 Start watching this issue

              Created:
              Updated:
              Resolved: