summaryrefslogtreecommitdiff
path: root/src/mongo/client
diff options
context:
space:
mode:
authorIrina Yatsenko <irina.yatsenko@mongodb.com>2021-05-28 18:57:59 +0000
committerEvergreen Agent <no-reply@evergreen.mongodb.com>2021-06-15 18:51:48 +0000
commit99b82261d146f49687977237f0d010c0a7b957cf (patch)
treee689e246a06fbdcd0364f458a8a05e96b52af714 /src/mongo/client
parent6abf79a4a8ae87059fb6a1fdc14d34a4bc59d1ff (diff)
downloadmongo-99b82261d146f49687977237f0d010c0a7b957cf.tar.gz
SERVER-57265 Migrate tests for deprecated op codes from jstest to C++ integration
Diffstat (limited to 'src/mongo/client')
-rw-r--r--src/mongo/client/dbclient_cursor.cpp6
-rw-r--r--src/mongo/client/query.cpp24
-rw-r--r--src/mongo/client/query.h8
3 files changed, 2 insertions, 36 deletions
diff --git a/src/mongo/client/dbclient_cursor.cpp b/src/mongo/client/dbclient_cursor.cpp
index b98e642f294..98cdf065d64 100644
--- a/src/mongo/client/dbclient_cursor.cpp
+++ b/src/mongo/client/dbclient_cursor.cpp
@@ -109,7 +109,7 @@ Message DBClientCursor::_assembleInit() {
// so we need to allow the shell to send invalid options so that we can
// test that the server rejects them. Thus, to allow generating commands with
// invalid options, we validate them here, and fall back to generating an OP_QUERY
- // through assembleQueryRequest if the options are invalid.
+ // through makeQueryMessage() if the options are invalid.
bool hasValidNToReturnForCommand = (nToReturn == 1 || nToReturn == -1);
bool hasValidFlagsForCommand = !(opts & mongo::QueryOption_Exhaust);
bool hasInvalidMaxTimeMs = query.hasField("$maxTimeMS");
@@ -175,9 +175,7 @@ Message DBClientCursor::_assembleInit() {
}
_useFindCommand = false; // Make sure we handle the reply correctly.
- Message toSend;
- assembleQueryRequest(ns.ns(), query, nextBatchSize(), nToSkip, fieldsToReturn, opts, toSend);
- return toSend;
+ return makeQueryMessage(ns.ns(), query, nextBatchSize(), nToSkip, fieldsToReturn, opts);
}
Message DBClientCursor::_assembleGetMore() {
diff --git a/src/mongo/client/query.cpp b/src/mongo/client/query.cpp
index 2e4a30cbad3..105d0a8169b 100644
--- a/src/mongo/client/query.cpp
+++ b/src/mongo/client/query.cpp
@@ -159,28 +159,4 @@ string Query::toString() const {
return obj.toString();
}
-void assembleQueryRequest(const string& ns,
- BSONObj query,
- int nToReturn,
- int nToSkip,
- const BSONObj* fieldsToReturn,
- int queryOptions,
- Message& toSend) {
- if (kDebugBuild) {
- massert(10337, (string) "object not valid assembleRequest query", query.isValid());
- }
-
- // see query.h for the protocol we are using here.
- BufBuilder b;
- int opts = queryOptions;
- b.appendNum(opts);
- b.appendStr(ns);
- b.appendNum(nToSkip);
- b.appendNum(nToReturn);
- query.appendSelfToBufBuilder(b);
- if (fieldsToReturn)
- fieldsToReturn->appendSelfToBufBuilder(b);
- toSend.setData(dbQuery, b.buf(), b.len());
-}
-
} // namespace mongo
diff --git a/src/mongo/client/query.h b/src/mongo/client/query.h
index 24444e853e8..63843079c9c 100644
--- a/src/mongo/client/query.h
+++ b/src/mongo/client/query.h
@@ -164,14 +164,6 @@ inline std::ostream& operator<<(std::ostream& s, const Query& q) {
return s << q.toString();
}
-void assembleQueryRequest(const std::string& ns,
- BSONObj query,
- int nToReturn,
- int nToSkip,
- const BSONObj* fieldsToReturn,
- int queryOptions,
- Message& toSend);
-
/** Typically one uses the QUERY(...) macro to construct a Query object.
Example: QUERY( "age" << 33 << "school" << "UCLA" )
*/