summaryrefslogtreecommitdiff
path: root/jstests/jni2.js
blob: b43d69a7749395cf18a28acc1b618670afcb013d (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
27
28
29
30

t = db.jni2;
t.remove( {} );

db.jni2t.remove( {} );

assert( 0 == db.jni2t.find().length() );

t.save( { z : 1 } );
t.save( { z : 2 } );
assert( 2 == t.find( { $where : 
                       function(){ 
                           db.jni2t.save( { y : 1 } );
                           return 1; 
                       } 
                     } ).length() );


assert( 2 == db.jni2t.find().length() );
assert( 1 == db.jni2t.find()[0].y );

assert( 2 == t.find( { $where : 
                       function(){ 
                           if ( db.jni2t.find().length() != 2 )
                               return 0;( { y : 1 } );
                           return 1; 
                       } 
                     } ).length() );

assert(t.validate().valid);