Files
mongo/jstests/core/query/set/set6.js
Jason Zhang 28eb8d299b SERVER-80780 Merge writes without shard key jscore passthrough with existing passthrough suites (#20175)
GitOrigin-RevId: a54cc3a3df44359ea51533f062642ee841f71460
2024-04-08 02:28:42 +00:00

19 lines
411 B
JavaScript

let t = db.set6;
t.drop();
let x = {_id: 1, r: new DBRef("foo", new ObjectId())};
t.insert(x);
assert.eq(x, t.findOne(), "A");
x.r.$id = new ObjectId();
t.update({}, {$set: {r: x.r}});
assert.eq(x, t.findOne(), "B");
x.r2 = new DBRef("foo2", 5);
t.update({}, {$set: {"r2": x.r2}});
assert.eq(x, t.findOne(), "C");
x.r.$id = 2;
t.update({}, {$set: {"r.$id": 2}});
assert.eq(x.r.$id, t.findOne().r.$id, "D");