Permalink
Browse files

Fix a bug in - (NSMutableArray *) bsonArrayWrapper:(mongo::BSONObj)re…

…tval function which is related to ObjectId Array display problem.
  • Loading branch information...
1 parent 610f948 commit 662a18116383f44e453f7f82b20a47d16e2f0d78 @bububa committed Jun 16, 2010
Showing with 9 additions and 0 deletions.
  1. +9 −0 MongoDB.mm
View
@@ -875,6 +875,15 @@ - (NSMutableArray *) bsonArrayWrapper:(mongo::BSONObj)retval
if (hasId) {
[arr addObject:[NSString stringWithFormat:@"%d", (long long int)(e.number())]];
}
+ }else if ([fieldName isEqualToString:@"_id" ]) {
+ if (e.type() == mongo::jstOID)
+ {
+ fieldType = @"ObjectId";
+ value = [NSString stringWithUTF8String:e.__oid().str().c_str()];
+ }else {
+ fieldType = @"String";
+ value = [NSString stringWithUTF8String:e.str().c_str()];
+ }
}else {
fieldType = @"String";
value = [NSString stringWithUTF8String:e.str().c_str()];

0 comments on commit 662a181

Please sign in to comment.