summaryrefslogtreecommitdiff
path: root/jstests/core/null.js
blob: b5508c689d9ddfbcc89fdb6f34f318523ab1e109 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26

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

t.save({x: 1});
t.save({x: null});

assert.eq(1, t.find({x: null}).count(), "A");
assert.eq(1, t.find({x: {$ne: null}}).count(), "B");

t.ensureIndex({x: 1});

assert.eq(1, t.find({x: null}).count(), "C");
assert.eq(1, t.find({x: {$ne: null}}).count(), "D");

// -----

assert.eq(2, t.find({y: null}).count(), "E");

t.ensureIndex({y: 1});
assert.eq(2, t.find({y: null}).count(), "E");

t.dropIndex({y: 1});

t.ensureIndex({y: 1}, {sparse: true});
assert.eq(2, t.find({y: null}).count(), "E");