2021-02-11 13:53:19 -05:00
|
|
|
/**
|
|
|
|
|
* Tests that $bit updates succeed if primaries compare updates numerically and secondaries compare
|
|
|
|
|
* updates lexicographically for array indexes.
|
|
|
|
|
*/
|
|
|
|
|
|
2024-08-20 17:54:15 -04:00
|
|
|
import {ReplSetTest} from "jstests/libs/replsettest.js";
|
|
|
|
|
|
2021-02-11 13:53:19 -05:00
|
|
|
const rst = new ReplSetTest({
|
|
|
|
|
nodes: 2,
|
|
|
|
|
nodeOptions: {binVersion: "latest"},
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
rst.startSet();
|
|
|
|
|
rst.initiate();
|
|
|
|
|
|
|
|
|
|
const primary = rst.getPrimary();
|
|
|
|
|
const testDB = primary.getDB(jsTestName());
|
|
|
|
|
const coll = testDB.test;
|
|
|
|
|
|
2023-07-12 15:53:02 +00:00
|
|
|
testDB.adminCommand({setFeatureCompatibilityVersion: lastLTSFCV, confirm: true});
|
2021-02-11 13:53:19 -05:00
|
|
|
|
|
|
|
|
assert.commandWorked(coll.insert({_id: 0, arr: [0]}));
|
|
|
|
|
|
2025-08-21 10:17:44 -07:00
|
|
|
assert.commandWorked(coll.update({_id: 0}, {$bit: {"a.9": {or: NumberInt(0)}, "a.10": {or: NumberInt(0)}}}));
|
2021-02-11 13:53:19 -05:00
|
|
|
|
2025-08-21 10:17:44 -07:00
|
|
|
rst.stopSet();
|