I've done some work with the legacy driver and now I'm upgrading to the new one. But I'm stuck with a problem.
I'm trying to append a b_binary to a basic document, but bytes is const *uint8_t. So, I can't append variable values, just static. Is there a way to append binary data to a basic document?
Example:
unsigned char ipv6[IPV6_SIZE];
int i = 0;
for (auto &byte : value)
{
ipv6[i++] = byte;
}
bsoncxx::types::b_binary bin_data;
bin_data.size = IPV6_SIZE;
bin_data.bytes = ipv6;
writeTo->append(kvp(key, bin_data));
That doesn't work because out of the context, ipv6 doesn't exist anymore. Please, if someone could help me, I'll be appreciate!