Skip to content

Commit bbb583c

Browse files
committed
Add remaining features to "What's New in 3.7" reference documentation
1 parent d4d9f16 commit bbb583c

File tree

1 file changed

+42
-0
lines changed

1 file changed

+42
-0
lines changed

docs/reference/content/whats-new.md

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,48 @@ Support for `Instant`, `LocalDate` and `LocalDateTime` has been added to the dri
6363
and / or more flexibility regarding JSR-310 dates should check out the alternative JSR-310 codecs provider by Cezary:
6464
[bson-codecs-jsr310](https://github.com/cbartosiak/bson-codecs-jsr310).
6565

66+
### JSR-305 NonNull annotations
67+
68+
The public API is now annotated with JSR-305 compatible `@NonNull` and `@Nullable` annotations. This will allow programmers
69+
to rely on tools like FindBugs/SpotBugs, IDEs like IntelliJ IDEA, and compilers like the Kotlin compiler to find errors in the use of the
70+
driver via static analysis rather than via runtime failures.
71+
72+
### Improved logging of commands
73+
74+
When the log level is set to DEBUG for the `org.mongodb.driver.protocol.command` logger, the driver now logs additional information to aid
75+
in debugging:
76+
77+
* Before sending the command, it logs the full command (up to 1000 characters), and the request id.
78+
* After receive a response to the command, it logs the request id and elapsed time in milliseconds.
79+
80+
Here's an example
81+
82+
```
83+
10:37:29.099 [cluster-ClusterId {value='5a466138741fc252712a6d71', description='null'}-127.0.0.1:27017] DEBUG org.mongodb.driver.protocol.command -
84+
Sending command '{ "ismaster" : 1, "$db" : "admin" } ...' with request id 4 to database admin on connection [connectionId{localValue:1, serverValue:1958}] to server 127.0.0.1:27017
85+
10:37:29.104 [cluster-ClusterId{value='5a466138741fc252712a6d71', description='null'}-127.0.0.1:27017] DEBUG org.mongodb.driver.protocol.command -
86+
Execution of command with request id 4 completed successfully in 22.44 ms on connection [connectionId {localValue:1, serverValue:1958}] to server 127.0.0.1:27017
87+
```
88+
89+
### Improved support for "raw" documents
90+
91+
When working with "raw" BSON for improved performance via the [`RawBsonDocument`]({{<apiref "org/bson/RawBsonDocument">}}), the efficiency
92+
of accessing embedded documents and arrays has been drastically improved by returning raw slices of the containing document or array. For
93+
instance
94+
95+
```java
96+
RawBsonDocument doc = new RawBsonDocument(bytes);
97+
98+
// returns a RawBsonDocument that is a slice of the bytes from the containing doc
99+
BsonDocument embeddedDoc = doc.getDocument("embeddedDoc");
100+
101+
// returns a RawBsonArray that is a slice of the bytes from the containing doc
102+
BsonArray embeddedArray = doc.getArray("embeddedArray");
103+
104+
// returns a RawBsonDocument that is a slice of the bytes from the containing array
105+
BsonDocument embeddedDoc2 = (BsonDocument) embeddedArray.get(0);
106+
```
107+
66108
## What's New in 3.6
67109

68110
Key new features of the 3.6 Java driver release:

0 commit comments

Comments
 (0)