refactor bson_type