# 데이터 형 변환

## 개요

데이터 형태를 변환하여 반환해요.

ex) "5" -> 5, 5 -> "5", "2022-12-24'T'12:14" -> Date("2022-12-24'T'12:14")

```
{
	"name": "cast", //고정(필수)
	"method": "type",//고정 (필수)
	"details": {
		"base": "tmpDocument.testString",//모든타입 (필수)
		"type": "dateTime", //String(필수)
		"format": "yyyy-MM-dd'T'HH:mm" //String(선택)
	}
}
```

## 필드

* details
  * base: 형 변환 대상이에요.&#x20;
  * type: 형 변환 타입이에요.&#x20;
  * format: 형 변환 대상의 date format 이에요.&#x20;
    * "type"이 "toDate"일 때는 필수 입력이에요.&#x20;

## 옵션

* details
  * type
    * ObjectId: 형 변환 대상이 String 일 경우 해당 String으로 ObjectId를 생성해요.&#x20;
    * toString: 형 변환 대상을 String으로 변환해요.
    * int: 형 변환 대상을 Integer으로 변환해요.
    * double: 형 변환 대상을 Double으로 변환해요.
    * toDate: 형 변환 대상을 Date으로 변환해요.
      * String: format 형에 맞춰서 String을 Date로 변환해요.&#x20;
      * Number: Long형을 Millisecond로 환산하여 Date로 변환해요.&#x20;

## 예시

```
{
	"name": "cast",
	"method": "type",
	"details": {
		"base": "3",
		"type": "int"
	}
}
->

3
```

## 예시(toDate)

```
{
	"name": "cast",
	"method": "type",
	"details": {
		"base": "2022-03-02",
		"type": "toDate",
		"format" : "yyyy-MM-dd"
	}
}
->

Date("2022-03-02")
```

## 사용 예시

```
....
{
	"@setValue": {
		"nextQuestion": {
			"name": "cast",
			"method": "type",
			"details": {
				"base": "tmpDocument.nextQuestion.priority",
				"type": "toString"
			}
		}
	}
}
...
```

2023.10.18 Bobby
