mongo/jstests/aggregation/expressions/concat.js

12 lines
377 B
JavaScript

/*
* Test that $concating empty string works correctly. May be extended in the future to include
* more thorough testing of $concat.
*/
const coll = db.concat;
coll.drop();
assert.commandWorked(coll.insert({}));
assert.eq(coll.findOne({}, {_id: false, "a": {$concat: [{$toLower: "$b"}]}}), {a: ""});
assert.eq(coll.findOne({}, {_id: false, "a": {$concat: []}}), {a: ""});