[CDRIVER-811] Clearer Design & document on Invalid bson_t Object Created: 26/Aug/15 Updated: 03/May/17 Resolved: 28/Aug/15 |
|
| Status: | Closed |
| Project: | C Driver |
| Component/s: | docs, libbson |
| Affects Version/s: | 1.1.10 |
| Fix Version/s: | None |
| Type: | Improvement | Priority: | Minor - P4 |
| Reporter: | Peng Xie | Assignee: | A. Jesse Jiryu Davis |
| Resolution: | Done | Votes: | 0 |
| Labels: | None | ||
| Remaining Estimate: | Not Specified | ||
| Time Spent: | Not Specified | ||
| Original Estimate: | Not Specified | ||
| Issue Links: |
|
||||||||
| Description |
|
I was stumped by a bug until the following demo revealed clues:
The first log_bson(&bson) works fine. But after bson_reinit(&child), bson is destroyed. The document of bson_append_document_end() says: There's a side effect if a user tried to make child valid again in a wrong way (if there is a correct way to do that.) Yet there are more "invalid" status if bson_append_xxx fail. It would be nice if there is some document to tell the users how to deal with an invalid bson_t object, or provide some function to save these objects (and us). |
| Comments |
| Comment by A. Jesse Jiryu Davis [ 28/Aug/15 ] |
|
Glad to hear it. |
| Comment by Peng Xie [ 28/Aug/15 ] |
|
Yes, indeed. I got further knowledge and am no longer confused by reading your replies below Thanks! |
| Comment by A. Jesse Jiryu Davis [ 27/Aug/15 ] |
|
Does simply calling "bson_init(&child)" instead of "bson_reinit(&child)" accomplish what you want? |