[SERVER-52846] Get rid of the old-style (getLastError-requiring) methods on DBDirectClient Created: 13/Nov/20  Updated: 29/Oct/23  Resolved: 21/Oct/21

Status: Closed
Project: Core Server
Component/s: Internal Client
Affects Version/s: None
Fix Version/s: 5.2.0

Type: Improvement Priority: Major - P3
Reporter: Kaloian Manassiev Assignee: Allison Easton
Resolution: Fixed Votes: 0
Labels: sharding-wfbf-sprint
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Backwards Compatibility: Fully Compatible
Sprint: Sharding EMEA 2021-10-18, Sharding EMEA 2021-11-01
Participants:

 Description   

DBDirectClient inherits from DBClientBase and as a result it picks up several write methods, which do not return any errors nor results and the caller is supposed to use getLastError afterwards in order to know what happened. Specifically these are: insert/update/delete and most likely create/dropIndexes.

This is very error prone, because user of this class can accidentally not check, expecting an exception to be thrown on error, but instead they get nothing and the method silently fails.

As part of this ticket, these methods should be removed and instead a more modern replacement should be introduced, which invokes commands under the hood and throws proper errors, similar to here.



 Comments   
Comment by Githook User [ 20/Oct/21 ]

Author:

{'name': 'Allison Easton', 'email': 'allison.easton@mongodb.com', 'username': 'allisoneaston'}

Message: SERVER-52846 Get rid of the old-style (getLastError-requiring) methods on DBDirectClient
Branch: master
https://github.com/mongodb/mongo/commit/e20bc9cd2933ab9c289e2bd7fa8c2120ee7f0e0a

Generated at Thu Feb 08 05:29:10 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.