2009-01-26 23:28:26 -05:00
|
|
|
|
|
|
|
|
t = db.getCollection( "basic1" );
|
2009-11-09 13:10:30 -05:00
|
|
|
t.drop();
|
2009-01-26 23:28:26 -05:00
|
|
|
|
|
|
|
|
o = { a : 1 };
|
|
|
|
|
t.save( o );
|
|
|
|
|
|
|
|
|
|
assert.eq( 1 , t.findOne().a , "first" );
|
|
|
|
|
assert( o._id , "now had id" );
|
|
|
|
|
assert( o._id.str , "id not a real id" );
|
|
|
|
|
|
|
|
|
|
o.a = 2;
|
|
|
|
|
t.save( o );
|
|
|
|
|
|
|
|
|
|
assert.eq( 2 , t.findOne().a , "second" );
|
|
|
|
|
|
|
|
|
|
assert(t.validate().valid);
|
2009-12-22 15:22:37 -05:00
|
|
|
|
|
|
|
|
// not a very good test of currentOp, but tests that it at least
|
|
|
|
|
// is sort of there:
|
|
|
|
|
assert( db.currentOp().inprog != null );
|