JSON_TYPE

The JSON_TYPE function returns the BSON type of the specified element.

Read syntax diagramSkip visual syntax diagram JSON_TYPE ( json-value , search-string , 2048 )

The schema is SYSTOOLS.

json-value
A BLOB column of a base table. The json-value must contain a BSON representation of a JSON document.
search-string
A path-qualified JSON field name.
search path size
The required value is 2048. The 2048 specifies the maximum length of the search-string parameter and must be left at this value.

The result of the function is an integer.

When querying the data types within a JSON document, the following values are returned:
Table 1. BSON type that is returned for the corresponding data types or null value
BSON type BSON id
Double 1
String 2
Object 3
Array 4
Binary data 5
Undefined 6
Object id 7
Boolean 8
Date 9
Null 10
Regular Expression 11
Future use 12
JavaScript 13
Symbol 14
JavaScript (with scope) 15
32-bit integer 16
Timestamp 17
64-bit integer 18