bson_as_json man page

The bson_as_json() function shall encode bson as a UTF-8 string using libbson's legacy JSON format. This function is superseded by bson_as_canonical_extended_json() and bson_as_relaxed_extended_json(), which use the same MongoDB Extended JSON format as all other MongoDB drivers.

The caller is responsible for freeing the resulting UTF-8 encoded string by calling bson_free() with the result.