mongodb/mongo-hadoop — pull request #113 by gminerbo (2014-08-07 23:04:45+00:00)
Title: BSONLoader has trouble with highly nested Mongo documents

I encountered problems using the BSONLoader to read highly nested Mongo documents.

For example,
```javascript
myPigRelation = LOAD '/data/mydata.bson' USING com.mongodb.hadoop.pig.BSONLoader(
'id',
'id:chararray,
var1:chararray,
var2:tuple(
mySub1:bag{tuple(id:int, pos:int, app:int, fav:chararray)},
mySub2:bag{tuple(id:int, sp:int, pos:int, app:int, fav:chararray)},
mySub3:bag{tuple(id:int,sp:int, pos:int, app:int, fav:chararray)},
mySub4:bag{tuple(id:chararray, pos:int, app:int, fav:chararray)},
mySub5:bag{tuple(id:int, sport:int, pos:int, app:int, fav:chararray)},
mySub6:bag{tuple(id:chararray, value:chararray, app:int)},
mySub7:bag{tuple(id:int, type:chararray, text:chararray, app:int,
metadata:bag{tuple(name:chararray, value:chararray, pos:int)}
)},
mySub8:bag{tuple(id:int, app:int, pos:int)}
),
var3:tuple(avatars:bag{tuple(url:chararray, type:int, approved:chararray)})'
);
```

The changes contained herein resolved the problem for me. The presence of the BasicDBObject & BasicDBList rather than BasicBSONObject and BasicBSONList seem like a mistake to me, yet my confidence is low as I would have expected this to be discovered by now.

Adding the LoadMetadata interface is just a convenience, but it was required due to the other processing I needed to do in my Pig script.

I can try to create a test case (bson file) for this, but it will take some time, as I cannot give away my data.
- Geoff