Skip to content

Commit 79c8caf

Browse files
committed
chore: update migration guide
1 parent 029a610 commit 79c8caf

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

etc/notes/CHANGES_5.0.0.md

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -191,3 +191,17 @@ await collection.insertMany([{ name: 'fido' }, { name: 'luna' }])
191191

192192
The `keepGoing` option was a legacy name for setting `ordered` to `false` for bulk inserts.
193193
It was only supported by the legacy `collection.insert()` method which is now removed as noted above.
194+
195+
### `withSession` and `withTransaction` now return the result of the provided callback.
196+
197+
These two methods previously returned `Promise<void>` but now users can control what the return value
198+
in the promise is:
199+
200+
```ts
201+
const value = await client.withSession(async (session) => {
202+
return session.withTransaction(async () => {
203+
await collection.insertOne({ a: 1 });
204+
return true;
205+
});
206+
}); // value is the boolean true;
207+
```

0 commit comments

Comments
 (0)