Skip to content

Commit 0dc9b45

Browse files
authored
docs: describe CRUD spec compliance (#2944)
1 parent 0f7f300 commit 0dc9b45

File tree

1 file changed

+34
-0
lines changed

1 file changed

+34
-0
lines changed

docs/CHANGES_4.0.0.md

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,40 @@ We now require node 12.9 or greater for version 4 of the driver.
2727
If that's outside your support matrix at this time, that's okay!
2828
Bug fix support for our 3.x branch will not be ending until summer 2022, which has support going back as far as Node.js v4!
2929

30+
### CRUD results
31+
32+
Our CRUD operations now return the drivers-wide spec-compliant results which are defined here:
33+
34+
- [CRUD SPEC Write Results](https://github.com/mongodb/specifications/blob/master/source/crud/crud.rst#write-results)
35+
36+
For example, `insertOne()` used to return an object that was shaped like:
37+
38+
```typescript
39+
interface LegacyInsertOneResult {
40+
insertedCount: number;
41+
ops: InsertedDocument[];
42+
insertedId: ObjectId;
43+
connection: Connection;
44+
result: { ok: number; n: number };
45+
}
46+
```
47+
48+
and now returns:
49+
50+
```typescript
51+
interface InsertOneResult {
52+
/**
53+
* Indicates whether this write result was acknowledged. If not, then all
54+
* other members of this result will be undefined.
55+
*/
56+
acknowledged: boolean;
57+
58+
/**
59+
* The identifier that was inserted. */
60+
insertedId: ObjectId;
61+
}
62+
```
63+
3064
### Cursor changes
3165

3266
Affected classes:

0 commit comments

Comments
 (0)