diff options
author | Benety Goh <benety@mongodb.com> | 2019-11-14 20:38:41 +0000 |
---|---|---|
committer | evergreen <evergreen@mongodb.com> | 2019-11-14 20:38:41 +0000 |
commit | 3f4312f26e1667826db51a0d2834eb417bb5de2d (patch) | |
tree | c745d9c6d63bd3637e2fda99fd4f9162c07db97f /jstests/core/indexu.js | |
parent | d24bae5300d3f6a342f5981f26e4309264aa4cb0 (diff) | |
download | mongo-3f4312f26e1667826db51a0d2834eb417bb5de2d.tar.gz |
SERVER-44619 truncate message for error code 16746 if too long
Diffstat (limited to 'jstests/core/indexu.js')
-rw-r--r-- | jstests/core/indexu.js | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/jstests/core/indexu.js b/jstests/core/indexu.js index f8b6af7f15d..0e68429eaf7 100644 --- a/jstests/core/indexu.js +++ b/jstests/core/indexu.js @@ -6,7 +6,7 @@ t = db.jstests_indexu; t.drop(); -var dupDoc = {a: [{'0': 1}]}; // There are two 'a.0' fields in this doc. +var dupDoc = {_id: 0, a: [{'0': 1}]}; // There are two 'a.0' fields in this doc. var dupDoc2 = {a: [{'1': 1}, 'c']}; var noDupDoc = {a: [{'1': 1}]}; @@ -14,6 +14,11 @@ var noDupDoc = {a: [{'1': 1}]}; assert.commandWorked(t.save(dupDoc)); assert.commandFailed(t.ensureIndex({'a.0': 1})); +// Test that we can fail gracefully when dupDoc has a large array padded with nulls. +// Index is based on max padding constant in mongo/db/update/path_support.h +assert.commandWorked(t.update({_id: 0}, {$set: {'a.1500001': 1}})); +assert.commandFailedWithCode(t.ensureIndex({'a.0': 1}), 16746); + t.remove({}); assert.commandWorked(t.ensureIndex({'a.0': 1})); assert.writeError(t.save(dupDoc)); |