diff options
author | Mathias Stearn <mathias@10gen.com> | 2013-02-07 14:54:52 -0500 |
---|---|---|
committer | Mathias Stearn <mathias@10gen.com> | 2013-02-07 15:48:20 -0500 |
commit | c2ff9da39bcc046e1964c86eb9ce436b9f6efc9c (patch) | |
tree | 188d1e8004b3424226cdab1992001a59be717073 /src/mongo/db | |
parent | 508775a628ca22a2a98acf1d5c0802885e81b9bf (diff) | |
download | mongo-c2ff9da39bcc046e1964c86eb9ce436b9f6efc9c.tar.gz |
SERVER-8239 $concat should only support strings
Diffstat (limited to 'src/mongo/db')
-rw-r--r-- | src/mongo/db/pipeline/expression.cpp | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/src/mongo/db/pipeline/expression.cpp b/src/mongo/db/pipeline/expression.cpp index 25a5d990ccf..d4a26ce78e4 100644 --- a/src/mongo/db/pipeline/expression.cpp +++ b/src/mongo/db/pipeline/expression.cpp @@ -741,6 +741,13 @@ namespace mongo { StringBuilder result; for (size_t i = 0; i < n; ++i) { Value val = vpOperand[i]->evaluate(input); + if (val.nullish()) + return Value(BSONNULL); + + uassert(16702, str::stream() << "$concat only supports strings, not " + << typeName(val.getType()), + val.getType() == String); + result << val.coerceToString(); } |