BsonObject bsonObjectFromTypeByte(int typeByte){
switch(typeByte){
case _BSON_DATA_INT:
return new BsonInt(null);
case _BSON_DATA_LONG:
return new BsonLong(null);
case _BSON_DATA_NUMBER:
return new BsonDouble(null);
case _BSON_DATA_STRING:
return new BsonString(null);
case _BSON_DATA_ARRAY:
return new BsonArray([]);
case _BSON_DATA_OBJECT:
return new BsonMap({});
case _BSON_DATA_OID:
return new ObjectId();
case _BSON_DATA_NULL:
return new BsonNull();
case _BSON_DATA_DBPOINTER:
return new DbRef(null,null);
case _BSON_DATA_BOOLEAN:
return new BsonBoolean(false);
case _BSON_DATA_BINARY:
return new BsonBinary(0);
case _BSON_DATA_DATE:
return new BsonDate(null);
case _BSON_DATA_CODE:
return new BsonCode(null);
case _BSON_DATA_REGEXP:
return new BsonRegexp(null);
case _BSON_DATA_TIMESTAMP:
return new Timestamp(0,0);
default:
throw new Exception("Not implemented for BSON TYPE $typeByte");
}
}