Skip to content
Browse files

test for using object as _id

  • Loading branch information...
1 parent f22a821 commit 2660c0ca229a557692780784a2b8b1a8ba7afd1f @erh erh committed Oct 15, 2009
Showing with 16 additions and 0 deletions.
  1. +16 −0 jstests/id1.js
View
16 jstests/id1.js
@@ -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 );

0 comments on commit 2660c0c

Please sign in to comment.
Something went wrong with that request. Please try again.