summaryrefslogtreecommitdiff
path: root/src/mongo/db/query/query_shape.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/mongo/db/query/query_shape.cpp')
-rw-r--r--src/mongo/db/query/query_shape.cpp35
1 files changed, 5 insertions, 30 deletions
diff --git a/src/mongo/db/query/query_shape.cpp b/src/mongo/db/query/query_shape.cpp
index 817583304a0..519b1115558 100644
--- a/src/mongo/db/query/query_shape.cpp
+++ b/src/mongo/db/query/query_shape.cpp
@@ -100,10 +100,9 @@ BSONObj extractSortShape(const BSONObj& sortSpec,
}
static std::string hintSpecialField = "$hint";
-void addLiteralFields(BSONObjBuilder* bob,
+void addShapeLiterals(BSONObjBuilder* bob,
const FindCommandRequest& findCommand,
const SerializationOptions& opts) {
-
if (auto limit = findCommand.getLimit()) {
opts.appendLiteral(
bob, FindCommandRequest::kLimitFieldName, static_cast<long long>(*limit));
@@ -111,17 +110,6 @@ void addLiteralFields(BSONObjBuilder* bob,
if (auto skip = findCommand.getSkip()) {
opts.appendLiteral(bob, FindCommandRequest::kSkipFieldName, static_cast<long long>(*skip));
}
- if (auto batchSize = findCommand.getBatchSize()) {
- opts.appendLiteral(
- bob, FindCommandRequest::kBatchSizeFieldName, static_cast<long long>(*batchSize));
- }
- if (auto maxTimeMs = findCommand.getMaxTimeMS()) {
- opts.appendLiteral(bob, FindCommandRequest::kMaxTimeMSFieldName, *maxTimeMs);
- }
- if (auto noCursorTimeout = findCommand.getNoCursorTimeout()) {
- opts.appendLiteral(
- bob, FindCommandRequest::kNoCursorTimeoutFieldName, bool(noCursorTimeout));
- }
}
static std::vector<
@@ -133,9 +121,8 @@ static std::vector<
{FindCommandRequest::kShowRecordIdFieldName, &FindCommandRequest::getShowRecordId},
{FindCommandRequest::kTailableFieldName, &FindCommandRequest::getTailable},
{FindCommandRequest::kAwaitDataFieldName, &FindCommandRequest::getAwaitData},
- {FindCommandRequest::kAllowPartialResultsFieldName,
- &FindCommandRequest::getAllowPartialResults},
{FindCommandRequest::kMirroredFieldName, &FindCommandRequest::getMirrored},
+ {FindCommandRequest::kOplogReplayFieldName, &FindCommandRequest::getOplogReplay},
};
std::vector<std::pair<StringData, std::function<const BSONObj(const FindCommandRequest&)>>>
objArgMap = {
@@ -230,19 +217,7 @@ BSONObj extractQueryShape(const FindCommandRequest& findCommand,
}
}
- // Redact the namespace of the command.
- {
- auto nssOrUUID = findCommand.getNamespaceOrUUID();
- std::string toSerialize;
- if (nssOrUUID.uuid()) {
- toSerialize = opts.serializeIdentifier(nssOrUUID.toString());
- } else {
- // Database is set at the command level, only serialize the collection here.
- toSerialize = opts.serializeIdentifier(nssOrUUID.nss()->coll());
- }
- bob.append(FindCommandRequest::kCommandName, toSerialize);
- }
-
+ bob.append("command", "find");
std::unique_ptr<MatchExpression> filterExpr;
// Filter.
{
@@ -299,8 +274,8 @@ BSONObj extractQueryShape(const FindCommandRequest& findCommand,
query_shape::extractSortShape(findCommand.getSort(), expCtx, opts));
}
- // Fields for literal redaction. Adds limit, skip, batchSize, maxTimeMS, and noCursorTimeOut
- addLiteralFields(&bob, findCommand, opts);
+ // Fields for literal redaction. Adds limit and skip.
+ addShapeLiterals(&bob, findCommand, opts);
// Add the fields that require no redaction.
addRemainingFindCommandFields(&bob, findCommand, opts);