charm: add bson marshaling for Reference, and extra tests