mirror of
https://github.com/mongodb/mongo.git
synced 2024-11-30 17:10:48 +01:00
test for using object as _id
This commit is contained in:
parent
f22a821979
commit
2660c0ca22
16
jstests/id1.js
Normal file
16
jstests/id1.js
Normal file
@ -0,0 +1,16 @@
|
||||
|
||||
t = db.id1
|
||||
t.drop();
|
||||
|
||||
t.save( { _id : { a : 1 , b : 2 } , x : "a" } );
|
||||
t.save( { _id : { a : 1 , b : 2 } , x : "b" } );
|
||||
t.save( { _id : { a : 3 , b : 2 } , x : "c" } );
|
||||
t.save( { _id : { a : 4 , b : 2 } , x : "d" } );
|
||||
t.save( { _id : { a : 4 , b : 2 } , x : "e" } );
|
||||
t.save( { _id : { a : 2 , b : 2 } , x : "f" } );
|
||||
|
||||
assert.eq( 4 , t.find().count() , "A" );
|
||||
assert.eq( "b" , t.findOne( { _id : { a : 1 , b : 2 } } ).x );
|
||||
assert.eq( "c" , t.findOne( { _id : { a : 3 , b : 2 } } ).x );
|
||||
assert.eq( "e" , t.findOne( { _id : { a : 4 , b : 2 } } ).x );
|
||||
assert.eq( "f" , t.findOne( { _id : { a : 2 , b : 2 } } ).x );
|
Loading…
Reference in New Issue
Block a user