File: server4638.js

package info (click to toggle)
mongodb 1%3A3.2.11-2%2Bdeb9u1
  • links: PTS, VCS
  • area: main
  • in suites: stretch
  • size: 196,404 kB
  • sloc: cpp: 1,412,793; ansic: 504,961; python: 78,522; perl: 5,837; sh: 5,661; java: 4,202; makefile: 1,784; pascal: 617; xml: 176; asm: 128
file content (16 lines) | stat: -rw-r--r-- 542 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
// SERVER-4638 - this tests explicit undefined values
// This case is marked as a dup of SERVER-4674

t = db.server4638;
t.drop();

t.insert({_id: 0, x: 0, undef: undefined});

// Make sure having an undefined doesn't break pipelines not using the field
res = t.aggregate({$project: {x: 1}}).toArray();
assert.eq(res[0].x, 0);

// 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");