Skip to content
This repository
Browse code

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
Prof Syd Xu authored

Showing 1 changed file with 9 additions and 0 deletions. Show diff stats Hide diff stats

  1. +9 0 MongoDB.mm
9 MongoDB.mm
@@ -875,6 +875,15 @@ - (NSMutableArray *) bsonArrayWrapper:(mongo::BSONObj)retval
875 875 if (hasId) {
876 876 [arr addObject:[NSString stringWithFormat:@"%d", (long long int)(e.number())]];
877 877 }
  878 + }else if ([fieldName isEqualToString:@"_id" ]) {
  879 + if (e.type() == mongo::jstOID)
  880 + {
  881 + fieldType = @"ObjectId";
  882 + value = [NSString stringWithUTF8String:e.__oid().str().c_str()];
  883 + }else {
  884 + fieldType = @"String";
  885 + value = [NSString stringWithUTF8String:e.str().c_str()];
  886 + }
878 887 }else {
879 888 fieldType = @"String";
880 889 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.