// IDString returns the original id as a string value
IDString returns the original id as a string value
// IDString returns the original id as a string value
func (m *Msg) IDString(key string) (string, error) {
	doc := m.Map()
	if doc == nil {
		return "", fmt.Errorf("data is not a map")
	}
	id, ok := doc[key]
	if !ok {
		return "", fmt.Errorf("no key %s found in Data", key)
	}
	switch t := id.(type) {
	case string:
		return t, nil
	case bson.ObjectId:
		return t.Hex(), nil
	case int32, int64, uint32, uint64:
		return fmt.Sprintf("%d", t), nil
	case float32, float64:
		return fmt.Sprintf("%f", t), nil
	default:
		return fmt.Sprintf("%v", t), nil
	}
}
func ( m * Msg ) IDString ( key string ) ( string , error ) { doc := m . Map ( ) if doc == nil { return " " , fmt . Errorf ( " " ) } id , ok := doc [ key ] if ! ok { return " " , fmt . Errorf ( " " , key ) } switch t := id . ( type ) { case string : return t , nil case bson . ObjectId : return t . Hex ( ) , nil case int32 , int64 , uint32 , uint64 : return fmt . Sprintf ( " " , t ) , nil case float32 , float64 : return fmt . Sprintf ( " " , t ) , nil default : return fmt . Sprintf ( " " , t ) , nil } }
IDString returns the original id as a string value
IDString returns the original id as a string value