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 #pragma once
32 
33 namespace mongo {
34 
35 /**
36  * These map to implementations of the PlanStage interface, all of which live in db/exec/
37  */
38 enum StageType {
39     STAGE_AND_HASH,
40     STAGE_AND_SORTED,
41     STAGE_CACHED_PLAN,
42     STAGE_COLLSCAN,
43 
44     // This stage sits at the root of the query tree and counts up the number of results
45     // returned by its child.
46     STAGE_COUNT,
47 
48     // If we're running a .count(), the query is fully covered by one ixscan, and the ixscan is
49     // from one key to another, we can just skip through the keys without bothering to examine
50     // them.
51     STAGE_COUNT_SCAN,
52 
53     STAGE_DELETE,
54 
55     // If we're running a distinct, we only care about one value for each key.  The distinct
56     // scan stage is an ixscan with some key-skipping behvaior that only distinct uses.
57     STAGE_DISTINCT_SCAN,
58 
59     // Dummy stage used for receiving notifications of deletions during chunk migration.
60     STAGE_NOTIFY_DELETE,
61 
62     STAGE_ENSURE_SORTED,
63 
64     STAGE_EOF,
65 
66     // This is more of an "internal-only" stage where we try to keep docs that were mutated
67     // during query execution.
68     STAGE_KEEP_MUTATIONS,
69 
70     STAGE_FETCH,
71 
72     // The two $geoNear impls imply a fetch+sort and must be stages.
73     STAGE_GEO_NEAR_2D,
74     STAGE_GEO_NEAR_2DSPHERE,
75 
76     STAGE_GROUP,
77 
78     STAGE_IDHACK,
79 
80     // Simple wrapper to iterate a SortedDataInterface::Cursor.
81     STAGE_INDEX_ITERATOR,
82 
83     STAGE_IXSCAN,
84     STAGE_LIMIT,
85 
86     // Implements parallelCollectionScan.
87     STAGE_MULTI_ITERATOR,
88 
89     STAGE_MULTI_PLAN,
90     STAGE_OPLOG_START,
91     STAGE_OR,
92     STAGE_PROJECTION,
93 
94     // Stage for running aggregation pipelines.
95     STAGE_PIPELINE_PROXY,
96 
97     STAGE_QUEUED_DATA,
98     STAGE_SHARDING_FILTER,
99     STAGE_SKIP,
100     STAGE_SORT,
101     STAGE_SORT_KEY_GENERATOR,
102     STAGE_SORT_MERGE,
103     STAGE_SUBPLAN,
104 
105     // Stages for running text search.
106     STAGE_TEXT,
107     STAGE_TEXT_OR,
108     STAGE_TEXT_MATCH,
109 
110     STAGE_UNKNOWN,
111 
112     STAGE_UPDATE,
113 };
114 
115 }  // namespace mongo
116