1 2 /** 3 * Copyright (C) 2018-present MongoDB, Inc. 4 * 5 * This program is free software: you can redistribute it and/or modify 6 * it under the terms of the Server Side Public License, version 1, 7 * as published by MongoDB, Inc. 8 * 9 * This program is distributed in the hope that it will be useful, 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 * Server Side Public License for more details. 13 * 14 * You should have received a copy of the Server Side Public License 15 * along with this program. If not, see 16 * <http://www.mongodb.com/licensing/server-side-public-license>. 17 * 18 * As a special exception, the copyright holders give permission to link the 19 * code of portions of this program with the OpenSSL library under certain 20 * conditions as described in each individual source file and distribute 21 * linked combinations including the program with the OpenSSL library. You 22 * must comply with the Server Side Public License in all respects for 23 * all of the code used other than as permitted herein. If you modify file(s) 24 * with this exception, you may extend this exception to your version of the 25 * file(s), but you are not obligated to do so. If you do not wish to do so, 26 * delete this exception statement from your version. If you delete this 27 * exception statement from all source files in the program, then also delete 28 * it in the license file. 29 */ 30 31 #include "mongo/platform/basic.h" 32 33 #include "mongo/db/pipeline/document_source.h" 34 35 #include "mongo/util/assert_util.h" 36 37 namespace mongo { 38 39 /** 40 * A stub MongoProcessInterface that can be used for testing. Create a subclass and override 41 * methods as needed. 42 */ 43 class StubMongoProcessInterface 44 : public DocumentSourceNeedsMongoProcessInterface::MongoProcessInterface { 45 public: 46 virtual ~StubMongoProcessInterface() = default; 47 setOperationContext(OperationContext * opCtx)48 void setOperationContext(OperationContext* opCtx) override { 49 MONGO_UNREACHABLE; 50 } 51 directClient()52 DBClientBase* directClient() override { 53 MONGO_UNREACHABLE; 54 } 55 isSharded(const NamespaceString & ns)56 bool isSharded(const NamespaceString& ns) override { 57 MONGO_UNREACHABLE; 58 } 59 insert(const NamespaceString & ns,const std::vector<BSONObj> & objs)60 BSONObj insert(const NamespaceString& ns, const std::vector<BSONObj>& objs) override { 61 MONGO_UNREACHABLE; 62 } 63 getIndexStats(OperationContext * opCtx,const NamespaceString & ns)64 CollectionIndexUsageMap getIndexStats(OperationContext* opCtx, 65 const NamespaceString& ns) override { 66 MONGO_UNREACHABLE; 67 } 68 appendLatencyStats(const NamespaceString & nss,bool includeHistograms,BSONObjBuilder * builder)69 void appendLatencyStats(const NamespaceString& nss, 70 bool includeHistograms, 71 BSONObjBuilder* builder) const override { 72 MONGO_UNREACHABLE; 73 } 74 appendStorageStats(const NamespaceString & nss,const BSONObj & param,BSONObjBuilder * builder)75 Status appendStorageStats(const NamespaceString& nss, 76 const BSONObj& param, 77 BSONObjBuilder* builder) const override { 78 MONGO_UNREACHABLE; 79 } 80 appendRecordCount(const NamespaceString & nss,BSONObjBuilder * builder)81 Status appendRecordCount(const NamespaceString& nss, BSONObjBuilder* builder) const override { 82 MONGO_UNREACHABLE; 83 } 84 getCollectionOptions(const NamespaceString & nss)85 BSONObj getCollectionOptions(const NamespaceString& nss) override { 86 MONGO_UNREACHABLE; 87 } 88 renameIfOptionsAndIndexesHaveNotChanged(const BSONObj & renameCommandObj,const NamespaceString & targetNs,const BSONObj & originalCollectionOptions,const std::list<BSONObj> & originalIndexes)89 Status renameIfOptionsAndIndexesHaveNotChanged( 90 const BSONObj& renameCommandObj, 91 const NamespaceString& targetNs, 92 const BSONObj& originalCollectionOptions, 93 const std::list<BSONObj>& originalIndexes) override { 94 MONGO_UNREACHABLE; 95 } 96 makePipeline(const std::vector<BSONObj> & rawPipeline,const boost::intrusive_ptr<ExpressionContext> & expCtx,const MakePipelineOptions opts)97 StatusWith<std::unique_ptr<Pipeline, Pipeline::Deleter>> makePipeline( 98 const std::vector<BSONObj>& rawPipeline, 99 const boost::intrusive_ptr<ExpressionContext>& expCtx, 100 const MakePipelineOptions opts) override { 101 MONGO_UNREACHABLE; 102 } 103 attachCursorSourceToPipeline(const boost::intrusive_ptr<ExpressionContext> & expCtx,Pipeline * pipeline)104 Status attachCursorSourceToPipeline(const boost::intrusive_ptr<ExpressionContext>& expCtx, 105 Pipeline* pipeline) override { 106 MONGO_UNREACHABLE; 107 } 108 getCurrentOps(CurrentOpConnectionsMode connMode,CurrentOpUserMode userMode,CurrentOpTruncateMode truncateMode)109 std::vector<BSONObj> getCurrentOps(CurrentOpConnectionsMode connMode, 110 CurrentOpUserMode userMode, 111 CurrentOpTruncateMode truncateMode) const override { 112 MONGO_UNREACHABLE; 113 } 114 getShardName(OperationContext * opCtx)115 std::string getShardName(OperationContext* opCtx) const override { 116 MONGO_UNREACHABLE; 117 } 118 collectDocumentKeyFields(UUID)119 std::vector<FieldPath> collectDocumentKeyFields(UUID) const override { 120 MONGO_UNREACHABLE; 121 } 122 lookupSingleDocument(const NamespaceString & nss,UUID collectionUUID,const Document & documentKey,boost::optional<BSONObj> readConcern)123 boost::optional<Document> lookupSingleDocument(const NamespaceString& nss, 124 UUID collectionUUID, 125 const Document& documentKey, 126 boost::optional<BSONObj> readConcern) { 127 MONGO_UNREACHABLE; 128 } 129 }; 130 } // namespace mongo 131