Files
mongo/jstests/aggregation/exec/undefined.js

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

17 lines
576 B
JavaScript
Raw Normal View History

2012-06-29 15:22:44 -04:00
// SERVER-4638 - this tests explicit undefined values
// This case is marked as a dup of SERVER-4674
2012-01-06 12:11:32 -05:00
const t = db[jsTestName()];
2012-01-06 12:11:32 -05:00
t.drop();
assert.commandWorked(t.insert({_id: 0, x: 0, undef: undefined}));
2012-06-29 15:22:44 -04:00
// Make sure having an undefined doesn't break pipelines not using the field
let res = t.aggregate({$project: {x: 1}}).toArray();
assert.eq(res[0].x, 0);
2012-01-06 12:11:32 -05:00
// Make sure having an undefined doesn't break pipelines that do use the field
res = t.aggregate({$project: {undef: 1}}).toArray();
assert.eq(res[0].undef, undefined);
assert.eq(typeof res[0].undef, "undefined");