[CXX-759] document/array::view.begin() != .end() for empty documents Created: 03/Dec/15  Updated: 14/Jan/16  Resolved: 04/Dec/15

Status: Closed
Project: C++ Driver
Component/s: BSON
Affects Version/s: 0.2.0
Fix Version/s: 3.0.0-rc0

Type: Bug Priority: Major - P3
Reporter: Mira Carey Assignee: Mira Carey
Resolution: Done Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Duplicate
is duplicated by CXX-809 Investigate SO question about handlin... Closed
Epic Link: C++11 Driver MongoDB 3.2

 Description   

For empty documents, a la

auto value = builder::stream::array{} << finalize;
auto view = value.view();
// view().begin() != view().end();

This is because we don't check the return value of bson_iter_next() when we first initialize the iterator, so users can end up with invalid iterators.

We should check the return value



 Comments   
Comment by Githook User [ 04/Dec/15 ]

Author:

{u'username': u'hanumantmk', u'name': u'Jason Carey', u'email': u'jcarey@argv.me'}

Message: CXX-759 working iterators for empty doc views
Branch: master
https://github.com/mongodb/mongo-cxx-driver/commit/2de12b10c6d15a87501653d2d56b942ed18116b5

Comment by Mira Carey [ 03/Dec/15 ]

https://github.com/mongodb/mongo-cxx-driver/pull/385

Generated at Wed Feb 07 22:00:14 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.