1BSON_READER_READ(3)                 Libbson                BSON_READER_READ(3)
2
3
4

NAME

6       bson_reader_read - bson_reader_read()
7

SYNOPSIS

9          const bson_t *
10          bson_reader_read (bson_reader_t *reader, bool *reached_eof);
11

PARAMETERS

13       · reader: A bson_reader_t.
14
15       · reached_eof: A UNKNOWN.
16

DESCRIPTION

18       The  bson_reader_read()  function shall read the next document from the
19       underlying file-descriptor or buffer.
20
21       If there are no further documents or a failure was detected, then  NULL
22       is returned.
23
24       If we reached the end of the sequence, reached_eof is set to true.
25
26       To detect an error, check for NULL and reached_of is false.
27

RETURNS

29       A bson_t that should not be modified or freed.
30

EXAMPLE

32          const bson_t *doc;
33          bool reached_eof = false;
34
35          while ((doc = bson_reader_read (reader, &reached_eof))) {
36             /* do something */
37          }
38
39          if (!reached_eof) {
40             fprintf (stderr, "Failed to read all documents.\n");
41          }
42

AUTHOR

44       MongoDB, Inc
45
47       2017-present, MongoDB, Inc
48
49
50
51
521.14.0                           Feb 22, 2019              BSON_READER_READ(3)
Impressum