Skip to content

Commit e96dd23

Browse files
author
Chris Cho
authored
DOCSP-32154: collStats deprecation (mongodb#431)
* DOCSP-32154: collStats deprecation
1 parent 5918da9 commit e96dd23

File tree

1 file changed

+28
-3
lines changed

1 file changed

+28
-3
lines changed

source/whats-new.txt

Lines changed: 28 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,29 @@ Learn what's new in:
3232
Upcoming Breaking Changes
3333
-------------------------
3434

35+
.. Relocate these items into the source/upgrade.txt page once they become breaking changes
36+
37+
The following changes affect future versions of the driver:
38+
39+
- The ``getStats()`` and ``isCapped()`` instance methods of the
40+
``DBCollection`` class are deprecated in v4.11. The corresponding server
41+
commands are deprecated in MongoDB v6.2 and later. Use the ``$collStats`` aggregation
42+
pipeline stage to retrieve the information provided by these methods
43+
instead. You can run the aggregation as shown in the following code example:
44+
45+
.. code-block:: java
46+
47+
collection.aggregate(Arrays.asList(
48+
new Document("$collStats",
49+
new Document("storageStats", new Document()))));
50+
51+
To determine whether the collection is a capped collection, access the value
52+
of the ``storageStats.capped`` field returned by this example aggregation.
53+
54+
To learn more about the ``$collStats`` aggregation operator, see the
55+
:manual:`$collStats (aggregation) </reference/operator/aggregation/collStats/>`
56+
Server manual entry.
57+
3558
- `MapReduceIterable <{+api+}/apidocs/mongodb-driver-sync/com/mongodb/client/MapReduceIterable.html>`__
3659
and map-reduce methods on `MongoCollection <{+api+}/apidocs/mongodb-driver-sync/com/mongodb/client/MongoCollection.html#mapReduce(com.mongodb.client.ClientSession,java.lang.String,java.lang.String)>`__
3760
are deprecated in MongoDB v4.2 and later. They will be replaced by the
@@ -46,9 +69,11 @@ What's New in 4.11
4669
.. note:: Upgraded Netty Version
4770

4871
The {+driver-short+} now tests with version 4.1.87.Final of the
49-
``io.netty:netty-all`` package. This change affects you only if you use the
72+
``io.netty:netty-all`` package. This change affects you only if you use the
5073
``SslContext`` class that Netty provides.
5174

75+
.. New features of the 4.11 driver release include:
76+
5277
.. _version-4.10:
5378

5479
What's New in 4.10
@@ -81,9 +106,9 @@ What's New in 4.9
81106
-----------------
82107

83108
.. important:: Aggregation Expression Operations Are in Beta
84-
109+
85110
This driver version introduces an API for creating
86-
:ref:`aggregation expressions <java-aggregation-expression-operations>`.
111+
:ref:`aggregation expressions <java-aggregation-expression-operations>`.
87112
This feature is in beta phase.
88113

89114
New features of the 4.9 driver release include:

0 commit comments

Comments
 (0)