summaryrefslogtreecommitdiff
path: root/src/mongo/db
diff options
context:
space:
mode:
authorKaloian Manassiev <kaloian.manassiev@mongodb.com>2021-02-17 06:42:59 -0500
committerEvergreen Agent <no-reply@evergreen.mongodb.com>2021-02-19 08:51:12 +0000
commita40e23d8613ad123e26112a61e26963909f1fa07 (patch)
tree2d710577f97a465af82713032c263e41601dff68 /src/mongo/db
parent23d05fa8b976208fd5564ace429d90d9f6c93509 (diff)
downloadmongo-a40e23d8613ad123e26112a61e26963909f1fa07.tar.gz
SERVER-54585 Enable running `findAndModify` against the Config server collections
Diffstat (limited to 'src/mongo/db')
-rw-r--r--src/mongo/db/SConscript3
-rw-r--r--src/mongo/db/dbdirectclient.cpp6
-rw-r--r--src/mongo/db/dbdirectclient.h4
-rw-r--r--src/mongo/db/ops/write_ops.idl2
-rw-r--r--src/mongo/db/pipeline/process_interface/shardsvr_process_interface.h1
-rw-r--r--src/mongo/db/s/resharding/resharding_donor_recipient_common_test.h1
-rw-r--r--src/mongo/db/s/shard_key_util.cpp1
7 files changed, 13 insertions, 5 deletions
diff --git a/src/mongo/db/SConscript b/src/mongo/db/SConscript
index 9387bcf0fe6..9770ed687ec 100644
--- a/src/mongo/db/SConscript
+++ b/src/mongo/db/SConscript
@@ -719,9 +719,10 @@ env.Library(
'$BUILD_DIR/mongo/client/clientdriver_minimal',
'curop',
'lasterror',
+ 'ops/write_ops_parsers',
],
LIBDEPS_PRIVATE=[
- '$BUILD_DIR/mongo/db/repl/repl_coordinator_interface',
+ 'repl/repl_coordinator_interface',
],
)
diff --git a/src/mongo/db/dbdirectclient.cpp b/src/mongo/db/dbdirectclient.cpp
index e5dc597df98..36b49be7756 100644
--- a/src/mongo/db/dbdirectclient.cpp
+++ b/src/mongo/db/dbdirectclient.cpp
@@ -174,6 +174,12 @@ unique_ptr<DBClientCursor> DBDirectClient::query(const NamespaceStringOrUUID& ns
nsOrUuid, query, nToReturn, nToSkip, fieldsToReturn, queryOptions, batchSize);
}
+write_ops::FindAndModifyReply DBDirectClient::findAndModify(
+ const write_ops::FindAndModifyCommand& findAndModify) {
+ auto response = runCommand(findAndModify.serialize({}));
+ return FindAndModifyOp::parseResponse(response->getCommandReply());
+}
+
long long DBDirectClient::count(const NamespaceStringOrUUID nsOrUuid,
const BSONObj& query,
int options,
diff --git a/src/mongo/db/dbdirectclient.h b/src/mongo/db/dbdirectclient.h
index c056c83b7cc..a14d05c19eb 100644
--- a/src/mongo/db/dbdirectclient.h
+++ b/src/mongo/db/dbdirectclient.h
@@ -33,6 +33,7 @@
#include "mongo/config.h"
#include "mongo/db/dbmessage.h"
#include "mongo/db/lasterror.h"
+#include "mongo/db/ops/write_ops.h"
#include "mongo/util/net/hostandport.h"
namespace mongo {
@@ -64,6 +65,9 @@ public:
int batchSize = 0,
boost::optional<BSONObj> readConcernObj = boost::none);
+ write_ops::FindAndModifyReply findAndModify(
+ const write_ops::FindAndModifyCommand& findAndModify);
+
virtual bool isFailed() const;
virtual bool isStillConnected();
diff --git a/src/mongo/db/ops/write_ops.idl b/src/mongo/db/ops/write_ops.idl
index b473499d271..a26460ab10b 100644
--- a/src/mongo/db/ops/write_ops.idl
+++ b/src/mongo/db/ops/write_ops.idl
@@ -84,7 +84,7 @@ structs:
optional: true
writeErrors:
description: "Contains all the errors encoutered."
- type: array<object>
+ type: array<object_owned>
optional: true
InsertReply:
diff --git a/src/mongo/db/pipeline/process_interface/shardsvr_process_interface.h b/src/mongo/db/pipeline/process_interface/shardsvr_process_interface.h
index 8ff9871bd0e..f574ea938ac 100644
--- a/src/mongo/db/pipeline/process_interface/shardsvr_process_interface.h
+++ b/src/mongo/db/pipeline/process_interface/shardsvr_process_interface.h
@@ -29,7 +29,6 @@
#pragma once
-#include "mongo/db/dbdirectclient.h"
#include "mongo/db/pipeline/pipeline.h"
#include "mongo/db/pipeline/process_interface/common_mongod_process_interface.h"
#include "mongo/s/catalog_cache.h"
diff --git a/src/mongo/db/s/resharding/resharding_donor_recipient_common_test.h b/src/mongo/db/s/resharding/resharding_donor_recipient_common_test.h
index a0bdb181523..1f6ec86230c 100644
--- a/src/mongo/db/s/resharding/resharding_donor_recipient_common_test.h
+++ b/src/mongo/db/s/resharding/resharding_donor_recipient_common_test.h
@@ -31,7 +31,6 @@
#include "mongo/db/catalog_raii.h"
#include "mongo/db/db_raii.h"
-#include "mongo/db/dbdirectclient.h"
#include "mongo/db/repl/wait_for_majority_service.h"
#include "mongo/db/s/collection_sharding_runtime.h"
#include "mongo/db/s/operation_sharding_state.h"
diff --git a/src/mongo/db/s/shard_key_util.cpp b/src/mongo/db/s/shard_key_util.cpp
index 9b71b8e1ec9..8bb381910b9 100644
--- a/src/mongo/db/s/shard_key_util.cpp
+++ b/src/mongo/db/s/shard_key_util.cpp
@@ -32,7 +32,6 @@
#include "mongo/db/s/shard_key_util.h"
#include "mongo/bson/simple_bsonelement_comparator.h"
-#include "mongo/db/dbdirectclient.h"
#include "mongo/db/hasher.h"
#include "mongo/db/index/index_descriptor.h"
#include "mongo/db/query/collation/collator_factory_interface.h"