-
Type: Bug
-
Resolution: Done
-
Priority: Major - P3
-
Affects Version/s: None
-
Component/s: Aggregation Framework
-
None
-
ALL
The following non-string types are allowed by the $concat operator. They should instead trigger an exception to be thrown:
- Null
- undefined
- missing
- Timestamps
- Dates
- Code
The jstests used to verify this are:
c = db.s6570; c.drop(); c.save({s: BinData(0,"e8MEnzZoFyMmD7WSHdNrFJyEk8M=") , t: ObjectId() , u: /abc.*def/i , v: null , w: undefined , x: new Timestamp() , y: new Date() , z: function() { var j=3; } }); assert.throws(function() {c.aggregate({$project:{_id:0, num : { $concat:[1, "$v", 2, "$v"] }}}).result;}, null, "$concat - null"); assert.throws(function() {c.aggregate({$project:{_id:0, num : { $concat:[1, "$w", 2, "$w"] }}}).result;}, null, "$concat - undefined"); assert.throws(function() {c.aggregate({$project:{_id:0, num : { $concat:[1, "$x", 2, "$x"] }}}).result;}, null, "$concat - timestamp"); assert.throws(function() {c.aggregate({$project:{_id:0, num : { $concat:[1, "$y", 2, "$y"] }}}).result;}, null, "$concat - date"); assert.throws(function() {c.aggregate({$project:{_id:0, num : { $concat:[1, "$z", 2, "$z"] }}}).result;}, null, "$concat - function"); assert.throws(function() {c.aggregate({$project:{_id:0, num : { $concat:[1, "$missing", 2, "$missing"] }}}).result;}, null, "$concat - missing");
- is related to
-
SERVER-30461 aggregation $concat expression is inconsistent in type checking with all other string expressions
- Backlog