Details
-
Task
-
Resolution: Done
-
Major - P3
-
None
-
3.0.0
-
None
-
ubuntu 16_04 x64, gcc 5.4
Description
Is it correct to store bsoncxx::document::element in containers without storing bsoncxx::document::value (parental document)?
I want to store a field from many documents and after transformation it to specific types... Like this:
std::list<bsoncxx::document::element> dataFields;
|
// ...
|
mongocxx::cursor::iterator iter = (*current);
|
bsoncxx::document::view_or_value doc(*iter);
|
dataFields.push_back(doc.view()['data']);
|
++(*current);
|
// ...
|
for(auto data: dataFields)
|
{
|
if (data)
|
{
|
if (data.type() == bsoncxx::type::k_document)
|
// everytime is ok
|
{
|
// ...
|
}
|
|
|
if (data.type() == bsoncxx::type::k_binary)
|
// sometimes throws "SIGABRT: src/bson/bson-iter.c:390 bson_iter_type(): precondition failed: iter->raw"
|
{
|
// ...
|
}
|
|
}
|
}
|