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

Doctests fails on unexpected keyPattern/keyValue fields in writeErrors

    XMLWordPrintable

Details

    • Bug
    • Status: Closed
    • Major - P3
    • Resolution: Fixed
    • None
    • 3.8
    • Docs, Tests
    • None

    Description

       [2019/03/05 13:59:46.586] **********************************************************************
       [2019/03/05 13:59:46.586] File "examples/bulk.rst", line 95, in default
       [2019/03/05 13:59:46.586] Failed example:
       [2019/03/05 13:59:46.586]     try:
       [2019/03/05 13:59:46.586]         db.test.bulk_write(requests)
       [2019/03/05 13:59:46.586]     except BulkWriteError as bwe:
       [2019/03/05 13:59:46.586]         pprint(bwe.details)
       [2019/03/05 13:59:46.586] Expected:
       [2019/03/05 13:59:46.586]     {'nInserted': 0,
       [2019/03/05 13:59:46.586]      'nMatched': 1,
       [2019/03/05 13:59:46.586]      'nModified': 1,
       [2019/03/05 13:59:46.586]      'nRemoved': 0,
       [2019/03/05 13:59:46.586]      'nUpserted': 0,
       [2019/03/05 13:59:46.586]      'upserted': [],
       [2019/03/05 13:59:46.586]      'writeConcernErrors': [],
       [2019/03/05 13:59:46.586]      'writeErrors': [{'code': 11000,
       [2019/03/05 13:59:46.586]                       'errmsg': '...E11000...duplicate key error...',
       [2019/03/05 13:59:46.586]                       'index': 1,
       [2019/03/05 13:59:46.586]                       'op': {'_id': 4}}]}
       [2019/03/05 13:59:46.586] Got:
       [2019/03/05 13:59:46.586]     {'nInserted': 0,
       [2019/03/05 13:59:46.586]      'nMatched': 1,
       [2019/03/05 13:59:46.586]      'nModified': 1,
       [2019/03/05 13:59:46.586]      'nRemoved': 0,
       [2019/03/05 13:59:46.586]      'nUpserted': 0,
       [2019/03/05 13:59:46.586]      'upserted': [],
       [2019/03/05 13:59:46.586]      'writeConcernErrors': [],
       [2019/03/05 13:59:46.586]      'writeErrors': [{'code': 11000,
       [2019/03/05 13:59:46.586]                       'errmsg': 'E11000 duplicate key error collection: '
       [2019/03/05 13:59:46.586]                                 'bulk_example.test index: _id_ dup key: { _id: '
       [2019/03/05 13:59:46.586]                                 '4 }',
       [2019/03/05 13:59:46.586]                       'index': 1,
       [2019/03/05 13:59:46.586]                       'keyPattern': {'_id': 1},
       [2019/03/05 13:59:46.586]                       'keyValue': {'': 4},
       [2019/03/05 13:59:46.586]                       'op': {'_id': 4}}]}
       [2019/03/05 13:59:46.598] **********************************************************************
       [2019/03/05 13:59:46.598] File "examples/bulk.rst", line 133, in default
       [2019/03/05 13:59:46.598] Failed example:
       [2019/03/05 13:59:46.598]     try:
       [2019/03/05 13:59:46.598]         db.test.bulk_write(requests, ordered=False)
       [2019/03/05 13:59:46.598]     except BulkWriteError as bwe:
       [2019/03/05 13:59:46.598]         pprint(bwe.details)
       [2019/03/05 13:59:46.598] Expected:
       [2019/03/05 13:59:46.598]     {'nInserted': 0,
       [2019/03/05 13:59:46.598]      'nMatched': 1,
       [2019/03/05 13:59:46.598]      'nModified': 1,
       [2019/03/05 13:59:46.598]      'nRemoved': 1,
       [2019/03/05 13:59:46.598]      'nUpserted': 0,
       [2019/03/05 13:59:46.598]      'upserted': [],
       [2019/03/05 13:59:46.598]      'writeConcernErrors': [],
       [2019/03/05 13:59:46.598]      'writeErrors': [{'code': 11000,
       [2019/03/05 13:59:46.598]                       'errmsg': '...E11000...duplicate key error...',
       [2019/03/05 13:59:46.598]                       'index': 0,
       [2019/03/05 13:59:46.598]                       'op': {'_id': 1}},
       [2019/03/05 13:59:46.598]                      {'code': 11000,
       [2019/03/05 13:59:46.598]                       'errmsg': '...E11000...duplicate key error...',
       [2019/03/05 13:59:46.598]                       'index': 2,
       [2019/03/05 13:59:46.598]                       'op': {'_id': 3}}]}
       [2019/03/05 13:59:46.598] Got:
       [2019/03/05 13:59:46.598]     {'nInserted': 0,
       [2019/03/05 13:59:46.598]      'nMatched': 1,
       [2019/03/05 13:59:46.598]      'nModified': 1,
       [2019/03/05 13:59:46.598]      'nRemoved': 1,
       [2019/03/05 13:59:46.598]      'nUpserted': 0,
       [2019/03/05 13:59:46.598]      'upserted': [],
       [2019/03/05 13:59:46.598]      'writeConcernErrors': [],
       [2019/03/05 13:59:46.598]      'writeErrors': [{'code': 11000,
       [2019/03/05 13:59:46.598]                       'errmsg': 'E11000 duplicate key error collection: '
       [2019/03/05 13:59:46.598]                                 'bulk_example.test index: _id_ dup key: { _id: '
       [2019/03/05 13:59:46.598]                                 '1 }',
       [2019/03/05 13:59:46.598]                       'index': 0,
       [2019/03/05 13:59:46.598]                       'keyPattern': {'_id': 1},
       [2019/03/05 13:59:46.598]                       'keyValue': {'': 1},
       [2019/03/05 13:59:46.598]                       'op': {'_id': 1}},
       [2019/03/05 13:59:46.598]                      {'code': 11000,
       [2019/03/05 13:59:46.598]                       'errmsg': 'E11000 duplicate key error collection: '
       [2019/03/05 13:59:46.598]                                 'bulk_example.test index: _id_ dup key: { _id: '
       [2019/03/05 13:59:46.598]                                 '3 }',
       [2019/03/05 13:59:46.598]                       'index': 2,
       [2019/03/05 13:59:46.598]                       'keyPattern': {'_id': 1},
       [2019/03/05 13:59:46.598]                       'keyValue': {'': 3},
       [2019/03/05 13:59:46.598]                       'op': {'_id': 3}}]}
      

      https://evergreen.mongodb.com/task/mongo_python_driver_tests_doctests__python_version~3.4_doctests_a84f50b998ea4614312b8ed13278c52031db2a54_19_03_05_02_25_05

      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: