.aggregate() helper doesn't preserve writeConcern information for tests

XMLWordPrintableJSON

    • Query Optimization
    • None
    • 3
    • None
    • None
    • None
    • None
    • None
    • None

      When the writeConcern fails it will still report to the user this error:

      2019-05-22T13:56:50.312-0400 E  QUERY    [js] uncaught exception: Error: command failed: {2019-05-22T13:56:50.312-0400 E  QUERY    [js] uncaught exception: Error: command failed: { "cursor" : { "firstBatch" : [ ], "id" : NumberLong(0), "ns" : "test.foo" }, "writeConcernError" : { "code" : 64, "codeName" : "WriteConcernFailed", "errmsg" : "waiting for replication timed out", "errInfo" : { "wtimeout" : true } }, "ok" : 1, "$clusterTime" : { "clusterTime" : Timestamp(1558547805, 1), "signature" : { "hash" : BinData(0,"AAAAAAAAAAAAAAAAAAAAAAAAAAA="), "keyId" : NumberLong(0) } }, "operationTime" : Timestamp(1558547805, 1)} : aggregate failed :_getErrorWithCode@src/mongo/shell/utils.js:25:13doassert@src/mongo/shell/assert.js:18:14_assertCommandWorked@src/mongo/shell/assert.js:584:17assert.commandWorked@src/mongo/shell/assert.js:674:16DB.prototype._runAggregate@src/mongo/shell/db.js:262:9DBCollection.prototype.aggregate@src/mongo/shell/collection.js:1004:12 

      However, in a test the error thrown will not have any properties we can expect to verify that the command failed for the expected reason. 

            Assignee:
            [DO NOT USE] Backlog - Query Optimization
            Reporter:
            Charlie Swanson
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated: