SERVER-21706 error when mapReduce outputs to config or admin db
(cherry picked from commit 3e1a3872c9)
This commit is contained in:
parent
5770fdcdf7
commit
126cecc636
@ -10,4 +10,20 @@ assert.commandFailed(testDB.runCommand({ mapReduce: 'user',
|
||||
reduce: reduceFunc,
|
||||
out: { inline: 1, sharded: true }}));
|
||||
|
||||
testDB.bar.insert({i: 1});
|
||||
assert.commandFailed(testDB.runCommand({ mapReduce: 'bar',
|
||||
map: function() {emit(this.i, this.i*3);},
|
||||
reduce: function(key, values) {return Array.sum(values)},
|
||||
out: { replace: "foo", db: "admin" }}));
|
||||
|
||||
assert.commandFailed(testDB.runCommand({ mapReduce: 'bar',
|
||||
map: function() {emit(this.i, this.i*3);},
|
||||
reduce: function(key, values) {return Array.sum(values)},
|
||||
out: { replace: "foo", db: "config" }}));
|
||||
|
||||
assert.commandWorked(testDB.runCommand({ mapReduce: 'bar',
|
||||
map: function() {emit(this.i, this.i*3);},
|
||||
reduce: function(key, values) {return Array.sum(values)},
|
||||
out: { replace: "foo", db: "test" }}));
|
||||
|
||||
st.stop();
|
||||
|
||||
@ -1566,6 +1566,14 @@ public:
|
||||
int,
|
||||
string& errmsg,
|
||||
BSONObjBuilder& result) {
|
||||
if (!grid.shardRegistry()) {
|
||||
return appendCommandStatus(
|
||||
result,
|
||||
Status(ErrorCodes::CommandNotSupported,
|
||||
str::stream() << "Can not execute mapReduce with output database "
|
||||
<< dbname));
|
||||
}
|
||||
|
||||
boost::optional<DisableDocumentValidation> maybeDisableValidation;
|
||||
if (shouldBypassDocumentValidationForCommand(cmdObj))
|
||||
maybeDisableValidation.emplace(txn);
|
||||
|
||||
Loading…
Reference in New Issue
Block a user