summaryrefslogtreecommitdiff
path: root/src/mongo/db/query/query_solution.cpp
diff options
context:
space:
mode:
authorDavid Storch <david.storch@10gen.com>2015-12-14 14:43:08 -0500
committerDavid Storch <david.storch@10gen.com>2015-12-21 16:28:22 -0500
commit56dba2953b622efcae75d7bd9b6aa4154dd25d34 (patch)
treea5509777ef6324edd6f710a44bd0973065c44422 /src/mongo/db/query/query_solution.cpp
parent6bfa81cae0b0fee124065c1f38de339fd4f3dc7c (diff)
downloadmongo-56dba2953b622efcae75d7bd9b6aa4154dd25d34.tar.gz
SERVER-17011 add EnsureSorted stage
Preserves the sort order for 'ntoreturn hack' plans.
Diffstat (limited to 'src/mongo/db/query/query_solution.cpp')
-rw-r--r--src/mongo/db/query/query_solution.cpp24
1 files changed, 24 insertions, 0 deletions
diff --git a/src/mongo/db/query/query_solution.cpp b/src/mongo/db/query/query_solution.cpp
index a80f9199b33..da1fa79c034 100644
--- a/src/mongo/db/query/query_solution.cpp
+++ b/src/mongo/db/query/query_solution.cpp
@@ -916,4 +916,28 @@ QuerySolutionNode* CountNode::clone() const {
return copy;
}
+//
+// EnsureSortedNode
+//
+
+void EnsureSortedNode::appendToString(mongoutils::str::stream* ss, int indent) const {
+ addIndent(ss, indent);
+ *ss << "ENSURE_SORTED\n";
+ addIndent(ss, indent + 1);
+ *ss << "pattern = " << pattern.toString() << '\n';
+ addCommon(ss, indent);
+ addIndent(ss, indent + 1);
+ *ss << "Child:" << '\n';
+ children[0]->appendToString(ss, indent + 2);
+}
+
+QuerySolutionNode* EnsureSortedNode::clone() const {
+ EnsureSortedNode* copy = new EnsureSortedNode();
+ cloneBaseData(copy);
+
+ copy->pattern = this->pattern;
+
+ return copy;
+}
+
} // namespace mongo