Files
mongo/jstests/core/ref4.js
Siyuan Zhou 3660343e0b SERVER-12127 migrate js tests to jscore suite when not related to writes
Migrate js tests starting from j-z.
Include SERVER-12920 Update use_power_of_2.js

Signed-off-by: Matt Kangas <matt.kangas@mongodb.com>
2014-03-03 22:54:10 -05:00

21 lines
511 B
JavaScript

a = db.ref4a;
b = db.ref4b;
a.drop();
b.drop();
var other = { s : "other thing", n : 17 };
b.save(other);
a.save( { name : "abc" , others : [ new DBRef( "ref4b" , other._id ) , new DBPointer( "ref4b" , other._id ) ] } );
assert( a.findOne().others[0].fetch().n == 17 , "dbref broken 1" );
x = Array.fetchRefs( a.findOne().others );
assert.eq( 2 , x.length , "A" );
assert.eq( 17 , x[0].n , "B" );
assert.eq( 17 , x[1].n , "C" );
assert.eq( 0 , Array.fetchRefs( a.findOne().others , "z" ).length , "D" );