Skip to content

DOCSP-32154: collStats deprecation #431

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 8 commits into from
Aug 29, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 28 additions & 3 deletions source/whats-new.txt
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,29 @@ Learn what's new in:
Upcoming Breaking Changes
-------------------------

.. Relocate these items into the source/upgrade.txt page once they become breaking changes

The following changes affect future versions of the driver:

- The ``getStats()`` and ``isCapped()`` instance methods of the
``DBCollection`` class are deprecated in v4.11. The corresponding server
commands are deprecated in MongoDB v6.2 and later. Use the ``$collStats`` aggregation
pipeline stage to retrieve the information provided by these methods
instead. You can run the aggregation as shown in the following code example:

.. code-block:: java

collection.aggregate(Arrays.asList(
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just checking whether you tested this, since I have not.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, I tested it. I posted valid code from which I extracted this snippet in our Slack channel when asking whether there was a more idiomatic way to get that data.

new Document("$collStats",
new Document("storageStats", new Document()))));

To determine whether the collection is a capped collection, access the value
of the ``storageStats.capped`` field returned by this example aggregation.

To learn more about the ``$collStats`` aggregation operator, see the
:manual:`$collStats (aggregation) </reference/operator/aggregation/collStats/>`
Server manual entry.

- `MapReduceIterable <{+api+}/apidocs/mongodb-driver-sync/com/mongodb/client/MapReduceIterable.html>`__
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)>`__
are deprecated in MongoDB v4.2 and later. They will be replaced by the
Expand All @@ -46,9 +69,11 @@ What's New in 4.11
.. note:: Upgraded Netty Version

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

.. New features of the 4.11 driver release include:

.. _version-4.10:

What's New in 4.10
Expand Down Expand Up @@ -81,9 +106,9 @@ What's New in 4.9
-----------------

.. important:: Aggregation Expression Operations Are in Beta

This driver version introduces an API for creating
:ref:`aggregation expressions <java-aggregation-expression-operations>`.
:ref:`aggregation expressions <java-aggregation-expression-operations>`.
This feature is in beta phase.

New features of the 4.9 driver release include:
Expand Down