Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

SERVER-2897 Additional test cases

  • Loading branch information...
commit 9d9275dc62b14334ed737bba7df9f305fd90315f 1 parent 9e354f7
@astaple astaple authored
Showing with 45 additions and 0 deletions.
  1. +45 −0 jstests/exists8.js
View
45 jstests/exists8.js
@@ -29,3 +29,48 @@ assert.eq( 1, t.count( {'a.0':{$exists:true}} ) );
assert.eq( 0, t.count( {'a.1':{$exists:false}} ) );
assert.eq( 0, t.count( {'a.0':{$exists:false}} ) );
assert.eq( 1, t.count( {'a.1':{$exists:true}} ) );
+
+t.remove();
+t.save( {a:[{'b':2},{'a':1}]} );
+assert.eq( 1, t.count( {'a.a':{$exists:true}} ) );
+assert.eq( 1, t.count( {'a.1.a':{$exists:true}} ) );
+assert.eq( 1, t.count( {'a.0.a':{$exists:false}} ) );
+
+t.remove();
+t.save( {a:[[1]]} );
+assert.eq( 1, t.count( {'a.0':{$exists:true}} ) );
+assert.eq( 1, t.count( {'a.0.0':{$exists:true}} ) );
+assert.eq( 0, t.count( {'a.0.0':{$exists:false}} ) );
+assert.eq( 0, t.count( {'a.0.0.0':{$exists:true}} ) );
+assert.eq( 1, t.count( {'a.0.0.0':{$exists:false}} ) );
+
+t.remove();
+t.save( {a:[[[1]]]} );
+assert.eq( 1, t.count( {'a.0.0.0':{$exists:true}} ) );
+
+t.remove();
+t.save( {a:[[{b:1}]]} );
+assert.eq( 0, t.count( {'a.b':{$exists:true}} ) );
+assert.eq( 1, t.count( {'a.b':{$exists:false}} ) );
+assert.eq( 1, t.count( {'a.0.b':{$exists:true}} ) );
+assert.eq( 0, t.count( {'a.0.b':{$exists:false}} ) );
+
+t.remove();
+t.save( {a:[[],[{b:1}]]} );
+assert.eq( 0, t.count( {'a.0.b':{$exists:true}} ) );
+assert.eq( 1, t.count( {'a.0.b':{$exists:false}} ) );
+
+t.remove();
+t.save( {a:[[],[{b:1}]]} );
+assert.eq( 1, t.count( {'a.1.b':{$exists:true}} ) );
+assert.eq( 0, t.count( {'a.1.b':{$exists:false}} ) );
+
+t.remove();
+t.save( {a:[[],[{b:1}]]} );
+assert.eq( 1, t.count( {'a.1.0.b':{$exists:true}} ) );
+assert.eq( 0, t.count( {'a.1.0.b':{$exists:false}} ) );
+
+t.remove();
+t.save( {a:[[],[{b:1}]]} );
+assert.eq( 0, t.count( {'a.1.1.b':{$exists:true}} ) );
+assert.eq( 1, t.count( {'a.1.1.b':{$exists:false}} ) );
Please sign in to comment.
Something went wrong with that request. Please try again.