summaryrefslogtreecommitdiff
path: root/jstests/jni2.js
blob: 150c04ad6a081f72250a97f3b6debba1f139eb12 (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
31

db = connect( "foo" );
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);