summaryrefslogtreecommitdiff
path: root/jstests/exists.js
diff options
context:
space:
mode:
authorAaron Staple <aaron@10gen.com>2009-08-03 15:02:30 -0400
committerAaron Staple <aaron@10gen.com>2009-08-03 15:02:30 -0400
commit652323c67c1b864e3ee8e48cda832ed71a874b00 (patch)
treee5fd04b0aab3b4c3b21aa389e1c9dae46c5a596d /jstests/exists.js
parent7162ec93433e789d1a0be02fed67b8a578eb6169 (diff)
downloadmongo-652323c67c1b864e3ee8e48cda832ed71a874b00.tar.gz
fix match for 'missing' elements
Diffstat (limited to 'jstests/exists.js')
-rw-r--r--jstests/exists.js12
1 files changed, 12 insertions, 0 deletions
diff --git a/jstests/exists.js b/jstests/exists.js
new file mode 100644
index 00000000000..dd5a13d6dd5
--- /dev/null
+++ b/jstests/exists.js
@@ -0,0 +1,12 @@
+t = db.jstests_exists;
+t.drop();
+
+t.save( {} );
+t.save( {a:1} );
+t.save( {a:{b:1}} );
+t.save( {a:{b:{c:1}}} );
+
+assert.eq( 4, t.count() );
+assert.eq( 3, t.count( {a:{$ne:null}} ) );
+assert.eq( 2, t.count( {'a.b':{$ne:null}} ) );
+assert.eq( 1, t.count( {'a.b.c':{$ne:null}} ) );