diff options
author | Ted Tuckman <ted.tuckman@mongodb.com> | 2021-02-11 13:53:19 -0500 |
---|---|---|
committer | Evergreen Agent <no-reply@evergreen.mongodb.com> | 2021-02-12 16:58:11 +0000 |
commit | 9ebdcb19f24adc3155f896693d9dc8931c0a5b34 (patch) | |
tree | 340e2d60042bf41baf26da13b54c75a36fbdc01e /jstests/core/update_bit_examples.js | |
parent | ee8c15294b11a098ebcb766fd216b7f6986106a4 (diff) | |
download | mongo-9ebdcb19f24adc3155f896693d9dc8931c0a5b34.tar.gz |
SERVER-50778 Compare array indexes numerically for updates
Diffstat (limited to 'jstests/core/update_bit_examples.js')
-rw-r--r-- | jstests/core/update_bit_examples.js | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/jstests/core/update_bit_examples.js b/jstests/core/update_bit_examples.js index 0b8f868ea17..1f1c03596e3 100644 --- a/jstests/core/update_bit_examples.js +++ b/jstests/core/update_bit_examples.js @@ -1,7 +1,7 @@ // Cannot implicitly shard accessed collections because of following errmsg: A single // update/delete on a sharded collection must contain an exact match on _id or contain the shard // key. -// @tags: [assumes_unsharded_collection, requires_non_retryable_writes] +// @tags: [assumes_unsharded_collection, requires_non_retryable_writes, requires_fcv_47] // Basic examples for $bit var res; @@ -32,3 +32,10 @@ assert.eq(coll.findOne().a, 4); // SERVER-19706 Empty bit operation. res = coll.update({}, {$bit: {a: {}}}); assert.writeError(res); + +// Make sure $bit on index arrays 9 and 10 when padding is needed works. +assert.commandWorked(coll.insert({_id: 2, a: [0]})); +assert.commandWorked( + coll.update({_id: 2}, {$bit: {"a.9": {or: NumberInt(0)}, "a.10": {or: NumberInt(0)}}})); +res = coll.find({_id: 2}).toArray(); +assert.eq(res[0]["a"], [0, null, null, null, null, null, null, null, null, 0, 0]); |