-
Type:
Bug
-
Resolution: Done
-
Priority:
Major - P3
-
Affects Version/s: None
-
Component/s: Implementation
-
None
-
None
-
None
-
None
-
None
-
None
-
None
-
None
My code:
std::vector<bsoncxx::document::value> documents;
for(int i = 0; i < 100; i++) {
documents.push_back(
bsoncxx::builder::stream::document{} << "i" << i << finalize);
}
auto result = collection.insert_many(documents);
if(result) {
auto ids = result.value().inserted_ids();
for (auto it = ids.begin(); it != ids.end(); ++it) {
//cout << it->second.get_oid().value.to_string() << endl;
auto second = it->second;
auto oId = second.get_oid();
auto idValue = oId.value;
string str = idValue.to_string();
}
}
I get the "src/bson/bson-iter.c:395 bson_iter_type(): precondition failed: iter->raw" exception on the "auto oId = second.get_oid();" line.