blob: 938a2f100b8c2902f4af1ddbf40e44aec19e28fe (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
|
a = db.dbref1a;
b = db.dbref1b;
a.drop();
b.drop();
a.save( { name : "eliot" } );
b.save( { num : 1 , link : new DBRef( "dbref1a" , a.findOne()._id ) } );
assert.eq( "eliot" , b.findOne().link.fetch().name , "A" );
assert.eq( 1 , b.find( function(){ return this.link.fetch().name == "eliot"; } ).count() , "B" );
assert.eq( 0 , b.find( function(){ return this.link.fetch().name == "el"; } ).count() , "C" );
|