summaryrefslogtreecommitdiff
path: root/src/mongo/db/pipeline/document_source_coll_stats.cpp
diff options
context:
space:
mode:
authorMathias Stearn <mathias@10gen.com>2016-06-24 13:00:15 -0400
committerMathias Stearn <mathias@10gen.com>2016-06-24 13:00:15 -0400
commita5e8fb2029c4d96daa0d07f287bf07a68a3ec1fa (patch)
tree1e7e18eba9b1e38fc98c5513a9ab160c57aeeff6 /src/mongo/db/pipeline/document_source_coll_stats.cpp
parent7ca9c5b6b9c64d1f332a08632f4ba5fd3dc1ff39 (diff)
downloadmongo-a5e8fb2029c4d96daa0d07f287bf07a68a3ec1fa.tar.gz
Revert "SERVER-5905 Add collStats aggregation stage"
This reverts commit a22d2843ccab7f0333434d1124358c5c182427f6.
Diffstat (limited to 'src/mongo/db/pipeline/document_source_coll_stats.cpp')
-rw-r--r--src/mongo/db/pipeline/document_source_coll_stats.cpp98
1 files changed, 0 insertions, 98 deletions
diff --git a/src/mongo/db/pipeline/document_source_coll_stats.cpp b/src/mongo/db/pipeline/document_source_coll_stats.cpp
deleted file mode 100644
index ab95e1d08d3..00000000000
--- a/src/mongo/db/pipeline/document_source_coll_stats.cpp
+++ /dev/null
@@ -1,98 +0,0 @@
-/**
- * Copyright (C) 2016 MongoDB Inc.
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License, version 3,
- * as published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Affero General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- *
- * As a special exception, the copyright holders give permission to link the
- * code of portions of this program with the OpenSSL library under certain
- * conditions as described in each individual source file and distribute
- * linked combinations including the program with the OpenSSL library. You
- * must comply with the GNU Affero General Public License in all respects
- * for all of the code used other than as permitted herein. If you modify
- * file(s) with this exception, you may extend this exception to your
- * version of the file(s), but you are not obligated to do so. If you do not
- * wish to do so, delete this exception statement from your version. If you
- * delete this exception statement from all source files in the program,
- * then also delete it in the license file.
- */
-
-#include "mongo/platform/basic.h"
-
-#include "mongo/db/pipeline/document_source.h"
-
-#include "mongo/bson/bsonobj.h"
-#include "mongo/db/stats/top.h"
-#include "mongo/util/time_support.h"
-
-using boost::intrusive_ptr;
-
-namespace mongo {
-
-REGISTER_DOCUMENT_SOURCE(collStats, DocumentSourceCollStats::createFromBson);
-
-const char* DocumentSourceCollStats::getSourceName() const {
- return "$collStats";
-}
-
-intrusive_ptr<DocumentSource> DocumentSourceCollStats::createFromBson(
- BSONElement specElem, const intrusive_ptr<ExpressionContext>& pExpCtx) {
- uassert(40166,
- str::stream() << "$collStats must take a nested object but found: " << specElem,
- specElem.type() == BSONType::Object);
- intrusive_ptr<DocumentSourceCollStats> collStats(new DocumentSourceCollStats(pExpCtx));
-
- for (const auto& elem : specElem.embeddedObject()) {
- StringData fieldName = elem.fieldNameStringData();
-
- if (fieldName == "latencyStats") {
- uassert(40167,
- str::stream() << "latencyStats argument must be an object, but found: " << elem,
- elem.type() == BSONType::Object);
- collStats->_latencySpecified = true;
- } else {
- uasserted(40168, str::stream() << "unrecognized option to $collStats: " << fieldName);
- }
- }
-
- return collStats;
-}
-
-boost::optional<Document> DocumentSourceCollStats::getNext() {
- if (_finished) {
- return boost::none;
- }
-
- _finished = true;
-
- BSONObjBuilder builder;
-
- builder.appendDate("localTime", jsTime());
- if (_latencySpecified) {
- _mongod->appendLatencyStats(pExpCtx->ns, &builder);
- }
-
- return Document(builder.obj());
-}
-
-bool DocumentSourceCollStats::isValidInitialSource() const {
- return true;
-}
-
-Value DocumentSourceCollStats::serialize(bool explain) const {
- if (_latencySpecified) {
- return Value(DOC(getSourceName() << DOC("latencyStats" << Document())));
- }
- return Value(DOC(getSourceName() << Document()));
-}
-
-} // namespace mongo