Skip to content

Commit ab8ab9c

Browse files
jmd-mongojeff-allen-mongo
authored andcommitted
DOCS-14668 deprecates the getLastError command
1 parent 244fd83 commit ab8ab9c

File tree

4 files changed

+31
-1
lines changed

4 files changed

+31
-1
lines changed

source/reference/command/getLastError.txt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,10 @@ Definition
1515

1616
.. dbcommand:: getLastError
1717

18+
Starting in MongoDB 5.0, :dbcommand:`getLastError` is deprecated. For
19+
more information and alternatives, see :ref:`Deprecated Wire Protocol
20+
Opcodes <deprecated-wire-protocol-opcodes>`.
21+
1822
.. include:: /includes/extracts/fact-2.6-wc-gle-change-cmd-getLastError.rst
1923

2024
Returns the error status of the preceding write operation on the

source/reference/method/db.getLastError.txt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,10 @@ Definition
1515

1616
.. method:: db.getLastError(<w>, <wtimeout>)
1717

18+
Starting in MongoDB 5.0, :method:`db.getLastError()` is deprecated.
19+
For more information and alternatives, see :ref:`Deprecated Wire
20+
Protocol Opcodes <deprecated-wire-protocol-opcodes>`.
21+
1822
.. include:: /includes/extracts/db.getLastError-definition.rst
1923

2024
.. include:: /includes/extracts/fact-2.6-wc-gle-change-method-db.getLastError.rst

source/reference/method/db.getLastErrorObj.txt

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,11 @@ Definition
1515

1616
.. method:: db.getLastErrorObj(w, wtimeout, j)
1717

18+
Starting in MongoDB 5.0, :method:`db.getLastErrorObj()` is
19+
deprecated. For more information and alternatives, see
20+
:ref:`Deprecated Wire Protocol Opcodes
21+
<deprecated-wire-protocol-opcodes>`.
22+
1823
.. include:: /includes/extracts/db.getLastErrorObj-definition.rst
1924

2025
.. include:: /includes/extracts/fact-2.6-wc-gle-change-method-db.getLastErrorObj.rst

source/release-notes/5.0-compatibility.txt

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -384,6 +384,8 @@ Deprecations
384384
the :ref:`clientMetadata <audit-message-clientMetadata>` audit message
385385
instead.
386386

387+
.. _deprecated-wire-protocol-opcodes:
388+
387389
Deprecated Wire Protocol Opcodes
388390
````````````````````````````````
389391

@@ -399,9 +401,24 @@ MongoDB 5.0 deprecates the following
399401
- ``OP_KILL_CURSORS``
400402

401403
Newer driver versions use :ref:`OP_MSG <wire-op-msg>` instead of these
402-
deprecated op codes. To ensure your driver uses the most up-to-date wire
404+
deprecated op codes.
405+
406+
The related commands and methods are also deprecated in MongoDB 5.0:
407+
408+
- :dbcommand:`getLastError`
409+
- :method:`db.getLastError()`
410+
- :method:`db.getLastErrorObj()`
411+
412+
To ensure your driver uses the most up-to-date wire
403413
protocol, upgrade your driver to a 5.0-compatible version.
404414

415+
Any code explicitly using :dbcommand:`getLastError`,
416+
:method:`db.getLastError()`, or :method:`db.getLastErrorObj()`
417+
should instead use the CRUD API to issue the write with
418+
the designed :doc:`write concern </reference/write-concern>`.
419+
Information about the success or failure of the write operation will be
420+
provided directly by the driver as a return value.
421+
405422
.. _5.0-compatibility-enabled:
406423

407424
5.0 Feature Compatibility

0 commit comments

Comments
 (0)