2009-01-27 05:28:26 +01:00
|
|
|
t = db.jni8;
|
|
|
|
t.drop();
|
|
|
|
|
|
|
|
t.save( { a : 1 , b : [ 2 , 3 , 4 ] } );
|
|
|
|
|
2009-05-07 04:26:32 +02:00
|
|
|
assert.eq( 1 , t.find().length() , "A" );
|
|
|
|
assert.eq( 1 , t.find( function(){ return this.a == 1; } ).length() , "B" );
|
2009-05-07 15:18:13 +02:00
|
|
|
assert.eq( 1 , t.find( function(){ if ( ! this.b.length ) return true; return this.b.length == 3; } ).length() , "B2" );
|
2009-05-07 04:26:32 +02:00
|
|
|
assert.eq( 1 , t.find( function(){ return this.b[0] == 2; } ).length() , "C" );
|
|
|
|
assert.eq( 0 , t.find( function(){ return this.b[0] == 3; } ).length() , "D" );
|
|
|
|
assert.eq( 1 , t.find( function(){ return this.b[1] == 3; } ).length() , "E" );
|
|
|
|
|
2009-01-27 05:28:26 +01:00
|
|
|
|
2009-01-31 23:22:22 +01:00
|
|
|
assert(t.validate().valid);
|