Skip to content

Commit 659f2a5

Browse files
committed
test(model): repro #8571
1 parent 56d24b5 commit 659f2a5

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

test/docs/transactions.test.js

+13
Original file line numberDiff line numberDiff line change
@@ -343,4 +343,17 @@ describe('transactions', function() {
343343
assert.deepEqual(fromDb, { name: 'Tyrion Lannister' });
344344
});
345345
});
346+
347+
it('save() with no changes (gh-8571)', function() {
348+
return co(function*() {
349+
const Test = db.model('Test', Schema({ name: String }));
350+
351+
yield Test.createCollection();
352+
const session = yield db.startSession();
353+
yield session.withTransaction(() => co(function*() {
354+
const [test] = yield Test.create([{}], { session });
355+
yield test.save(); // throws DocumentNotFoundError
356+
}));
357+
});
358+
});
346359
});

0 commit comments

Comments
 (0)