BSON processing functions

BSON processing functions manipulate BSON data. Some SQL statements require function expressions that call these built-in functions.

You do not need to use these functions when you operate on BSON data through MongoDB API commands.

Use the following built-in functions in SQL statements to return the values of the specified field as standard SQL data types:
  • BSON_VALUE_BIGINT( ) function
  • BSON_VALUE_BOOLEAN( ) function
  • BSON_VALUE_DATE( ) function
  • BSON_VALUE_DOUBLE( ) function
  • BSON_VALUE_INT( ) function
  • BSON_VALUE_LVARCHAR( ) function
  • BSON_VALUE_OBJECTID( ) function
  • BSON_VALUE_TIMESTAMP( ) function
  • BSON_VALUE_VARCHAR( ) function
Each function converts the values in a field in a BSON column to the SQL data type that is specified in the name of the function, except the BSON_VALUE_OBJECTID function, which returns a string. The returned values do not require casts to JSON.
Use the following functions to manipulate BSON field-value pairs:
  • BSON_GET( ) function
  • BSON_UPDATE( ) function

The BSON_SIZE( ) function returns the size of field values in BSON documents.

The genBSON function converts SQL data into BSON documents.


Copyright© 2020 HCL Technologies Limited