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

Seg fault with $max and $bucketAuto

    • Type: Icon: Bug Bug
    • Resolution: Duplicate
    • Priority: Icon: Major - P3 Major - P3
    • None
    • Affects Version/s: 3.4.0, 3.4.1
    • Component/s: None
    • None
    • ALL

      When going through M034 with MongoDB 3.4.1 on Mac OS X Yosemite v 10.10.5 I generated a seg fault on the server by running the following query on the following dataset. Backtrace attached. Seg fault also generated on 3.4.0. with the same query and dataset.

      Dataset: https://university.mongodb.com/static/MongoDB_2016_M034_ondemand_v1/handouts/companies_dataset/companies.2a9d317cfa74.json

      db.companies.aggregate( [
            {'$match': { 'number_of_employees' : {'$type': 'int'} }},
            { '$facet': {
              'Employees': [
                {'$bucketAuto': {
                  'groupBy': '$number_of_employees',
                  'buckets': 3,
                  'granularity': '1-2-5',
                  'output': {
      		value: {$max: '$number_of_employees'}
                }
              }}],
          }
        }]).pretty()
      

      However the same query replacing '$max' with '$sum' works just fine.

      db.companies.aggregate( [
            {'$match': { 'number_of_employees' : {'$type': 'int'} }},
            { '$facet': {
              'Employees': [
                {'$bucketAuto': {
                  'groupBy': '$number_of_employees',
                  'buckets': 3,
                  'granularity': '1-2-5',
                  'output': {
      		value: {$sum: "$number_of_employees"}
                }
              }}],
          }
        }]).pretty()
      

            Assignee:
            david.storch@mongodb.com David Storch
            Reporter:
            nathaniel.may Nathaniel May
            Votes:
            0 Vote for this issue
            Watchers:
            5 Start watching this issue

              Created:
              Updated:
              Resolved: