2012-07-27 14:16:59 -04:00
|
|
|
// stop allowing field inclusion in objects in expressions
|
2012-12-18 13:26:26 -05:00
|
|
|
load('jstests/aggregation/extras/utils.js');
|
|
|
|
|
|
2012-07-27 14:16:59 -04:00
|
|
|
c = db.s6529;
|
|
|
|
|
|
|
|
|
|
c.drop();
|
|
|
|
|
c.save({a:{b:{c:{d:{e:{f:{g:19}}}}}}});
|
|
|
|
|
|
|
|
|
|
// bad project
|
2012-12-18 13:26:26 -05:00
|
|
|
assertErrorCode(c, {$project:{foo:{$add:[{b:1}]}}}, 16420);
|
2012-07-27 14:16:59 -04:00
|
|
|
// $group shouldnt allow numeric inclusions
|
2014-02-05 16:06:12 -05:00
|
|
|
assertErrorCode(c, {$group:{_id: {a:1}}}, 17390);
|
2012-12-18 13:26:26 -05:00
|
|
|
|
2012-07-27 14:16:59 -04:00
|
|
|
// but any amount of nesting in a project should work
|
2013-10-08 13:29:04 -04:00
|
|
|
assert.eq(c.aggregate({$project:{_id:0, a:{b:{c:{d:{e:{f:{g:1}}}}}}}}).toArray(), [{a:{b:{c:{d:{e:{f:{g:19}}}}}}}]);
|
|
|
|
|
assert.eq(c.aggregate({$project:{_id:0, a:{b:{c:{d:{e:{f:1}}}}}}}).toArray(), [{a:{b:{c:{d:{e:{f:{g:19}}}}}}}]);
|
|
|
|
|
assert.eq(c.aggregate({$project:{_id:0, a:{b:{c:{d:{e:1}}}}}}).toArray(), [{a:{b:{c:{d:{e:{f:{g:19}}}}}}}]);
|
|
|
|
|
assert.eq(c.aggregate({$project:{_id:0, a:{b:{c:{d:1}}}}}).toArray(), [{a:{b:{c:{d:{e:{f:{g:19}}}}}}}]);
|
|
|
|
|
assert.eq(c.aggregate({$project:{_id:0, a:{b:{c:1}}}}).toArray(), [{a:{b:{c:{d:{e:{f:{g:19}}}}}}}]);
|
|
|
|
|
assert.eq(c.aggregate({$project:{_id:0, a:{b:1}}}).toArray(), [{a:{b:{c:{d:{e:{f:{g:19}}}}}}}]);
|
|
|
|
|
assert.eq(c.aggregate({$project:{_id:0, a:1}}).toArray(), [{a:{b:{c:{d:{e:{f:{g:19}}}}}}}]);
|