@@ -101,44 +101,44 @@ var tests = testCase({
101101 // })
102102 // })
103103 // },
104-
105- shouldCorrectlyPerformBasicInsert : function ( test ) {
106- client . createCollection ( 'test_insert' , function ( err , r ) {
107- client . collection ( 'test_insert' , function ( err , collection ) {
108-
109- Step (
110- function inserts ( ) {
111- var group = this . group ( ) ;
112-
113- for ( var i = 1 ; i < 1000 ; i ++ ) {
114- collection . insert ( { c :i } , { safe :true } , group ( ) ) ;
115- }
116- } ,
117-
118- function done ( err , result ) {
119- collection . insert ( { a :2 } , { safe :true } , function ( err , r ) {
120- collection . insert ( { a :3 } , { safe :true } , function ( err , r ) {
121- collection . count ( function ( err , count ) {
122- test . equal ( 1001 , count ) ;
123- // Locate all the entries using find
124- collection . find ( function ( err , cursor ) {
125- cursor . toArray ( function ( err , results ) {
126- test . equal ( 1001 , results . length ) ;
127- test . ok ( results [ 0 ] != null ) ;
128-
129- // Let's close the db
130- test . done ( ) ;
131- } ) ;
132- } ) ;
133- } ) ;
134- } ) ;
135- } ) ;
136- }
137- )
138- } ) ;
139- } ) ;
140- } ,
141-
104+ //
105+ // shouldCorrectlyPerformBasicInsert : function(test) {
106+ // client.createCollection('test_insert', function(err, r) {
107+ // client.collection('test_insert', function(err, collection) {
108+ //
109+ // Step(
110+ // function inserts() {
111+ // var group = this.group();
112+ //
113+ // for(var i = 1; i < 1000; i++) {
114+ // collection.insert({c:i}, {safe:true}, group());
115+ // }
116+ // },
117+ //
118+ // function done(err, result) {
119+ // collection.insert({a:2}, {safe:true}, function(err, r) {
120+ // collection.insert({a:3}, {safe:true}, function(err, r) {
121+ // collection.count(function(err, count) {
122+ // test.equal(1001, count);
123+ // // Locate all the entries using find
124+ // collection.find(function(err, cursor) {
125+ // cursor.toArray(function(err, results) {
126+ // test.equal(1001, results.length);
127+ // test.ok(results[0] != null);
128+ //
129+ // // Let's close the db
130+ // test.done();
131+ // });
132+ // });
133+ // });
134+ // });
135+ // });
136+ // }
137+ // )
138+ // });
139+ // });
140+ // },
141+ //
142142 // // Test multiple document insert
143143 // shouldCorrectlyHandleMultipleDocumentInsert : function(test) {
144144 // client.createCollection('test_multiple_insert', function(err, r) {
@@ -615,7 +615,46 @@ var tests = testCase({
615615 // })
616616 // });
617617 // });
618- // }
618+ // },
619+
620+ shouldCorrectlyExecuteMultipleFetches : function ( test ) {
621+ var db = new Db ( MONGODB , new Server ( 'localhost' , 27017 , { auto_reconnect : true } ) , { native_parser : ( process . env [ 'TEST_NATIVE' ] != null ) } ) ;
622+ db . bson_deserializer = client . bson_deserializer ;
623+ db . bson_serializer = client . bson_serializer ;
624+ db . pkFactory = client . pkFactory ;
625+
626+ // Search parameter
627+ var to = 'ralph'
628+ // Execute query
629+ db . open ( function ( err , db ) {
630+ db . collection ( 'shouldCorrectlyExecuteMultipleFetches' , function ( err , collection ) {
631+ collection . insert ( { addresses :{ localPart :'ralph' } } , { safe :true } , function ( err , result ) {
632+ // Let's find our user
633+ collection . findOne ( { "addresses.localPart" : to } , function ( err , doc ) {
634+ if ( err ) {
635+ console . log ( "collection.findOne: " + err ) ;
636+ }
637+
638+ // console.log( "doc: " + doc );
639+ // db.close();
640+ // test.done();
641+ } ) ;
642+
643+ collection . findOne ( { "addresses.localPart" : to } , function ( err , doc ) {
644+ if ( err ) {
645+ console . log ( "collection.findOne: " + err ) ;
646+ }
647+
648+ debug ( inspect ( doc ) )
649+ // console.log( "doc: " + doc );
650+ db . close ( ) ;
651+ test . done ( ) ;
652+ } ) ;
653+ } ) ;
654+ } ) ;
655+ } ) ;
656+ }
657+
619658} )
620659
621660// Stupid freaking workaround due to there being no way to run setup once for each suite
0 commit comments