[CXX-513] Ensure we don't depend on the "no such cmd" error message Created: 09/Feb/15  Updated: 23/Feb/15  Resolved: 23/Feb/15

Status: Closed
Project: C++ Driver
Component/s: Implementation
Affects Version/s: None
Fix Version/s: legacy-1.0.1

Type: Task Priority: Major - P3
Reporter: Tyler Brock Assignee: Adam Midvidy
Resolution: Done Votes: 0
Labels: legacy-cxx
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified
Environment:

All


Issue Links:
Depends
is depended on by DRIVERS-192 Error message changed for command not... Closed

 Description   

Using grep I am seeing that we might depend on this in certain places within the legacy driver.

src/mongo/client/dbclient.cpp
1227:                                   strstr( e.valuestr(), "no such cmd: saslStart")));
1600:                    ( errmsg.find( "no such cmd" ) != string::npos )
2225:                    ( errmsg.find( "no such cmd" ) != string::npos )



 Comments   
Comment by Adam Midvidy [ 23/Feb/15 ]

Looking at the 3 uses of the string "no such cmd"

1) in copyDatabase we check if the server's error message contains "no such cmd: saslStart" to return a better error message in the case that the server doesn't support SCRAM. We don't need to make changes here, because only an old server (with the old way of sending error messages) would ever trigger this code path. Also note that the code is correct even if this comparison fails, since then we would just throw an OperationException.

2) in enumerateCollections we check "no such cmd" to see if we are talking to an old server that doesn't support listCollections. We are OK here because we also check if the error code is 59 (CommandNotFound) first.

3) In enumerateIndexes, same as (2) we also check error code 59.

Generated at Wed Feb 07 21:59:26 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.