[CDRIVER-153] Iterate empty BSON Created: 26/Jun/12  Updated: 03/May/17  Resolved: 01/Aug/12

Status: Closed
Project: C Driver
Component/s: None
Affects Version/s: None
Fix Version/s: None

Type: Bug Priority: Minor - P4
Reporter: Morten Kvistgaard Assignee: Gary Murakami
Resolution: Done Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified


 Description   

The following will create an error:

  • Initialize a bson
  • Finish it (without appending anything)
  • Iterate through it


 Comments   
Comment by Gary Murakami [ 01/Aug/12 ]

Resolving this, please reopen with more details if there is any remaining issue.

Comment by Gary Murakami [ 28/Jul/12 ]

With what release version of the driver or git commit do you have this problem. The following test (fragment) works for me circa 0.6.

bson_init( b );
bson_finish( b );
bson_iterator_init( i, b );
ret = bson_iterator_more( i );
printf("test_bson_iterator bson_iterator_more returns:%d\n", ret);
ret = bson_iterator_next( i );
printf("test_bson_iterator bson_iterator_next returns:%d\n", ret);
ret = bson_iterator_type( i );
printf("test_bson_iterator bson_iterator_type returns:%d\n", ret);
bson_destroy( b );

output
------
test_bson_iterator bson_iterator_more returns:0
test_bson_iterator bson_iterator_next returns:0
test_bson_iterator bson_iterator_type returns:0

Generated at Wed Feb 07 21:08:36 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.