Uploaded image for project: 'Python Driver'
  1. Python Driver
  2. PYTHON-2119

Fix failing mapReduce doctests caused by the MR in Agg project

    XMLWordPrintableJSON

Details

    • Task
    • Status: Closed
    • Major - P3
    • Resolution: Fixed
    • None
    • 3.11
    • None
    • None

    Description

      These mapReduce doc tests are failing on MongoDB 4.3:

      Document: examples/aggregation
      ------------------------------
      **********************************************************************
      File "examples/aggregation.rst", line 121, in default
      Failed example:
          for doc in result.find():
            pprint.pprint(doc)
      Expected:
          {'_id': 'cat', 'value': 3.0}
          {'_id': 'dog', 'value': 2.0}
          {'_id': 'mouse', 'value': 1.0}
      Got:
          {'_id': 'cat', 'value': 3.0}
          {'_id': 'mouse', 'value': 1.0}
          {'_id': 'dog', 'value': 2.0}
      **********************************************************************
      File "examples/aggregation.rst", line 139, in default
      Failed example:
          pprint.pprint(
              db.things.map_reduce(mapper, reducer, "myresults", full_response=True))
      Expected:
          {...'counts': {'emit': 6, 'input': 4, 'output': 3, 'reduce': 2},
           'ok': ...,
           'result': '...',
           'timeMillis': ...}
      Got:
          {'$clusterTime': {'clusterTime': Timestamp(1581123789, 1669),
                            'signature': {'hash': '\x00\x00\x00\x00\x00\x00\x00\x00'
                                                  '\x00\x00\x00\x00\x00\x00\x00\x00'
                                                  '\x00\x00\x00\x00',
                                          'keyId': 0}},
           'ok': 1.0,
           'operationTime': Timestamp(1581123789, 1669),
           'result': 'myresults'}
      **********************************************************************
      File "examples/aggregation.rst", line 154, in default
      Failed example:
          for doc in results.find():
            pprint.pprint(doc)
      Expected:
          {'_id': 'cat', 'value': 1.0}
          {'_id': 'dog', 'value': 1.0}
      Got:
          {'_id': 'dog', 'value': 1.0}
          {'_id': 'cat', 'value': 1.0}
      **********************************************************************
      File "examples/aggregation.rst", line 166, in default
      Failed example:
          pprint.pprint(
              db.things.map_reduce(
                  mapper,
                  reducer,
                  out=SON([("replace", "results"), ("db", "outdb")]),
                  full_response=True))
      Expected:
          {...'counts': {'emit': 6, 'input': 4, 'output': 3, 'reduce': 2},
           'ok': ...,
           'result': {'collection': ..., 'db': ...},
           'timeMillis': ...}
      Got:
          {'$clusterTime': {'clusterTime': Timestamp(1581123789, 1678),
                            'signature': {'hash': '\x00\x00\x00\x00\x00\x00\x00\x00'
                                                  '\x00\x00\x00\x00\x00\x00\x00\x00'
                                                  '\x00\x00\x00\x00',
                                          'keyId': 0}},
           'ok': 1.0,
           'operationTime': Timestamp(1581123789, 1678),
           'result': {'collection': 'results', 'db': 'outdb'}}
      **********************************************************************
      1 items had failures:

      The interesting thing here is that it appears the order of mapReduce's resulting collection is no longer stable.

      Attachments

        Issue Links

          Activity

            People

              shane.harvey@mongodb.com Shane Harvey
              shane.harvey@mongodb.com Shane Harvey
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: