summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEsha Maharishi <esha.maharishi@mongodb.com>2018-03-13 23:04:39 -0400
committerEsha Maharishi <esha.maharishi@mongodb.com>2018-03-21 21:35:57 -0400
commitf655d53a9da6b58ff255c1885a55ffa1cfecfef4 (patch)
tree39e5bcb58e964b68b26ff3245b4cf1297a64462a
parentf0575e255effe2c2e9d909187c8ee73ab2431b29 (diff)
downloadmongo-f655d53a9da6b58ff255c1885a55ffa1cfecfef4.tar.gz
SERVER-33869 make $changeStream on shards check shardVersion
(cherry picked from commit acaa16d190a0a5ef6a431e8a4b3eacd54a529ed7)
-rw-r--r--src/mongo/db/commands/run_aggregate.cpp13
1 files changed, 7 insertions, 6 deletions
diff --git a/src/mongo/db/commands/run_aggregate.cpp b/src/mongo/db/commands/run_aggregate.cpp
index 4406c84240e..5c89b87f11b 100644
--- a/src/mongo/db/commands/run_aggregate.cpp
+++ b/src/mongo/db/commands/run_aggregate.cpp
@@ -362,12 +362,13 @@ Status runAggregate(OperationContext* opCtx,
// of the collection on which $changeStream was invoked, so that we do not end up
// resolving the collation on the oplog.
invariant(!collatorToUse);
- // Change streams can only be run against collections; AutoGetCollection will raise an
- // error if the given namespace is a view. A change stream may be opened on a namespace
- // before the associated collection is created, but only if the database already exists.
- // If the $changeStream was sent from mongoS then the database exists at the cluster
- // level even if not yet present on this shard, so we allow the $changeStream to run.
- AutoGetCollection origNssCtx(opCtx, origNss, MODE_IS);
+ // Change streams can only be run against collections; AutoGetCollectionForReadCommand
+ // will raise an error if the given namespace is a view. A change stream may be opened
+ // on a namespace before the associated collection is created, but only if the database
+ // already exists. If the $changeStream was sent from mongoS then the database exists at
+ // the cluster level even if not yet present on this shard, so we allow the
+ // $changeStream to run.
+ AutoGetCollectionForReadCommand origNssCtx(opCtx, origNss);
uassert(ErrorCodes::NamespaceNotFound,
str::stream() << "cannot open $changeStream for non-existent database: "
<< origNss.db(),