Skip to content

Commit ef878b1

Browse files
committed
Remove outdated references to $unwind as an expression rather than a source
1 parent 94a0643 commit ef878b1

File tree

2 files changed

+5
-42
lines changed

2 files changed

+5
-42
lines changed

src/mongo/db/pipeline/expression.cpp

Lines changed: 3 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -34,17 +34,9 @@ namespace mongo {
3434
verify(false && "Expression::toMatcherBson()");
3535
}
3636

37-
Expression::ObjectCtx::ObjectCtx(int theOptions):
38-
options(theOptions),
39-
unwindField() {
40-
}
41-
42-
void Expression::ObjectCtx::unwind(string fieldName) {
43-
verify(unwindOk());
44-
verify(!unwindUsed());
45-
verify(fieldName.size());
46-
unwindField = fieldName;
47-
}
37+
Expression::ObjectCtx::ObjectCtx(int theOptions)
38+
: options(theOptions)
39+
{}
4840

4941
bool Expression::ObjectCtx::documentOk() const {
5042
return ((options & DOCUMENT_OK) != 0);
@@ -54,8 +46,6 @@ namespace mongo {
5446
return ((options & TOP_LEVEL) != 0);
5547
}
5648

57-
const char Expression::unwindName[] = "$unwind";
58-
5949
string Expression::removeFieldPrefix(const string &prefixedField) {
6050
const char *pPrefixedField = prefixedField.c_str();
6151
uassert(15982, str::stream() <<
@@ -72,11 +62,6 @@ namespace mongo {
7262
7363
f0: {f1: ..., f2: ..., f3: ...}
7464
f0: {$operator:[operand1, operand2, ...]}
75-
f0: {$unwind:"fieldpath"}
76-
77-
We handle $unwind as a special case, because this is done by the
78-
projection source. For any other expression, we hand over control to
79-
code that parses the expression and returns an expression.
8065
*/
8166

8267
intrusive_ptr<Expression> pExpression; // the result

src/mongo/db/pipeline/expression.h

Lines changed: 2 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -133,32 +133,20 @@ namespace mongo {
133133
/*
134134
Utility class for parseObject() below.
135135
136-
Only one array can be unwound in a processing pipeline. If the
137-
UNWIND_OK option is used, unwindOk() will return true, and a field
138-
can be declared as unwound using unwind(), after which unwindUsed()
139-
will return true. Only specify UNWIND_OK if it is OK to unwind an
140-
array in the current context.
141-
142136
DOCUMENT_OK indicates that it is OK to use a Document in the current
143137
context.
144138
*/
145139
class ObjectCtx {
146140
public:
147141
ObjectCtx(int options);
148-
static const int UNWIND_OK = 0x0001;
149-
static const int DOCUMENT_OK = 0x0002;
150-
static const int TOP_LEVEL = 0x0004;
151-
152-
bool unwindOk() const;
153-
bool unwindUsed() const;
154-
void unwind(string fieldName);
142+
static const int DOCUMENT_OK = 0x0001;
143+
static const int TOP_LEVEL = 0x0002;
155144

156145
bool documentOk() const;
157146
bool topLevel() const;
158147

159148
private:
160149
int options;
161-
string unwindField;
162150
};
163151

164152
/*
@@ -172,8 +160,6 @@ namespace mongo {
172160
static intrusive_ptr<Expression> parseObject(
173161
BSONElement *pBsonElement, ObjectCtx *pCtx);
174162

175-
static const char unwindName[];
176-
177163
/*
178164
Parse a BSONElement Object which has already been determined to be
179165
functional expression.
@@ -1222,14 +1208,6 @@ namespace mongo {
12221208

12231209
namespace mongo {
12241210

1225-
inline bool Expression::ObjectCtx::unwindOk() const {
1226-
return ((options & UNWIND_OK) != 0);
1227-
}
1228-
1229-
inline bool Expression::ObjectCtx::unwindUsed() const {
1230-
return (unwindField.size() != 0);
1231-
}
1232-
12331211
inline int Expression::signum(int i) {
12341212
if (i < 0)
12351213
return -1;

0 commit comments

Comments
 (0)