Example #1
0
BSONCXX_INLINE_NAMESPACE_BEGIN

decimal128::decimal128(stdx::string_view str) {
    bson_decimal128_t d128;
    if (!bson_decimal128_from_string(str.to_string().c_str(), &d128)) {
        throw bsoncxx::exception{error_code::k_invalid_decimal128};
    }
    _high = d128.high;
    _low = d128.low;
}
Example #2
0
view::iterator view::find(stdx::string_view key) const {
    bson_t b;
    bson_iter_t iter;

    if (!bson_init_static(&b, _data, _length)) {
        return end();
    }

    if (bson_iter_init_find(&iter, &b, key.to_string().data())) {
        return iterator(element(iter.raw, iter.len, iter.off));
    } else {
        return end();
    }
}
Example #3
0
void write_concern::tag(stdx::string_view confirm_from) {
    libmongoc::write_concern_set_wtag(_impl->write_concern_t, confirm_from.to_string().data());
}