1BSON_READER_READ(3) libbson BSON_READER_READ(3)
2
3
4
6 const bson_t *
7 bson_reader_read (bson_reader_t *reader, bool *reached_eof);
8
10 • reader: A bson_reader_t.
11
12 • reached_eof: A UNKNOWN.
13
15 The bson_reader_read() function shall read the next document from the
16 underlying file-descriptor or buffer.
17
18 If there are no further documents or a failure was detected, then NULL
19 is returned.
20
21 If we reached the end of the sequence, reached_eof is set to true.
22
23 To detect an error, check for NULL and reached_of is false.
24
26 A bson_t that should not be modified or freed.
27
29 const bson_t *doc;
30 bool reached_eof = false;
31
32 while ((doc = bson_reader_read (reader, &reached_eof))) {
33 /* do something */
34 }
35
36 if (!reached_eof) {
37 fprintf (stderr, "Failed to read all documents.\n");
38 }
39
41 MongoDB, Inc
42
44 2017-present, MongoDB, Inc
45
46
47
48
491.25.1 Nov 08, 2023 BSON_READER_READ(3)