bson_new_from_json()
.The bson_new_from_json()
function allocates and initialize a new bson_t
by parsing the JSON found in data
.
Only a single JSON object may exist in data or an error will be set and
NULL
returned.
# Wrapper for `bson_new_from_json()`.
#
# The `bson_new_from_json()` function allocates and initialize a new `bson_t`
# by parsing the JSON found in `data`.
# Only a single JSON object may exist in data or an error will be set and
# `NULL` returned.
new from_json_string(data: CString) import set_mongoc_error `{
bson_error_t error;
bson_t *bson;
bson = bson_new_from_json((uint8_t *)data, -1, &error);
if(!bson) {
NativeBSON_set_mongoc_error(bson, &error);
return NULL;
}
return bson;
`}
lib/mongodb/native_mongodb.nit:45,2--60,3