From 7181b55276aaff56933522378dfede7708638d68 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9r=C3=B4me=20Lebel?= Date: Sat, 4 Oct 2014 21:24:30 +0200 Subject: [PATCH] test for https://github.com/jeromelebel/MongoHub-Mac/issues/140 --- MongoObjCDriver Tests/MODClientTestCase.m | 26 +++++++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/MongoObjCDriver Tests/MODClientTestCase.m b/MongoObjCDriver Tests/MODClientTestCase.m index 74afd5e2..646af9d7 100644 --- a/MongoObjCDriver Tests/MODClientTestCase.m +++ b/MongoObjCDriver Tests/MODClientTestCase.m @@ -200,4 +200,30 @@ - (void)testLotOfCollections CFRunLoopRun(); } +- (void)testBigDocuments +{ + MODCollection *collection; + MODSortedMutableDictionary *document; + NSMutableArray *documents = [NSMutableArray array]; + NSString *value = @"fdsafsdafds afsdafdsafsdafdsafsdaf dsafsdafdsafsdafdsafsdafdsafs dafdsafsdafdsafsdafd safsdafdsafsdaf dsafsdafdsafsdafd safsdafdsafsdafd safsdafdsafsdafdsa fsdafdsafsdafdsa fsdafdsafsdafdsa fsdafdsafsdafdsafsd afdsafsdafdsafsdafdsafsdaf"; + NSUInteger ii; + + collection = [[self.server databaseForName:DATABASE_NAME_TEST] collectionForName:@"BigDocuments"]; + document = [[MODSortedMutableDictionary alloc] init]; + for (ii = 0; ii < 50; ii++) { + [document setObject:value forKey:[NSString stringWithFormat:@"big key fads f das fd sa fs f as fdsa dsa f dsa f %lu", ii]]; + } + for (ii = 0; ii < 15; ii++) { + [documents addObject:document]; + } + [collection removeWithCriteria:nil callback:nil]; + [collection insertWithDocuments:documents callback:^(MODQuery *mongoQuery) { + [self logMongoQuery:mongoQuery]; + }]; + [collection findWithCriteria:nil fields:nil skip:0 limit:100 sort:nil callback:^(NSArray *documents, NSArray *bsonData, MODQuery *mongoQuery) { + CFRunLoopStop(CFRunLoopGetCurrent()); + }]; + CFRunLoopRun(); +} + @end