Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

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

…tval function which is related to ObjectId Array display problem.
  • Loading branch information...
commit 662a18116383f44e453f7f82b20a47d16e2f0d78 1 parent 610f948
@bububa authored
Showing with 9 additions and 0 deletions.
  1. +9 −0 MongoDB.mm
View
9 MongoDB.mm
@@ -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.
Something went wrong with that request. Please try again.