1MONGOC_CLIENT_WATCH(3)         MongoDB C Driver         MONGOC_CLIENT_WATCH(3)
2
3
4

NAME

6       mongoc_client_watch - mongoc_client_watch()
7

SYNOPSIS

9          mongoc_change_stream_t*
10          mongoc_client_watch (mongoc_client_t *client,
11                               const bson_t *pipeline,
12                               const bson_t *opts);
13
14       A  helper  function  to create a change stream. It is preferred to call
15       this function over using a raw aggregation to create a change stream.
16
17       This function uses the read preference and read concern of the  client.
18       If  the  change  stream needs to re-establish connection, the same read
19       preference will be used. This may happen if the change  stream  encoun‐
20       ters a resumable error.
21
22       WARNING:
23          A change stream is only supported with majority read concern.
24

PARAMETERS

26       · db:  A  mongoc_client_t specifying the client which the change stream
27         listens to.
28
29       · pipeline: A bson_t representing an aggregation pipeline  appended  to
30         the change stream. This may be an empty document.
31
32       · opts: A bson_t containing change stream options.
33
34       opts may be NULL or a BSON document with additional command options:
35
36       · batchSize:  An int32 representing number of documents requested to be
37         returned on each call to mongoc_change_stream_next
38
39       · resumeAfter: A Document representing the logical  starting  point  of
40         the  change  stream.  The  _id  field   of any change received from a
41         change stream can be used here
42
43       · startAtOperationTime: A Timestamp. The change  stream  only  provides
44         changes  that  occurred at or after the specified timestamp. Any com‐
45         mand run against the server will return an operation time that can be
46         used here.
47
48       · maxAwaitTimeMS:  An  int64  representing the maximum amount of time a
49         call to mongoc_change_stream_next will block waiting for data
50
51       · fullDocument: A UTF-8 string. Set this option  to  "updateLookup"  to
52         direct  the  change  stream  cursor to lookup the most current major‐
53         ity-committed version of the document associated to an update  change
54         stream event.
55

RETURNS

57       A  newly allocated mongoc_change_stream_t which must be freed with mon‐
58       goc_change_stream_destroy when no longer  in  use.  The  returned  mon‐
59       goc_change_stream_t  is  never  NULL.  If  there is an error, it can be
60       retrieved  with  mongoc_change_stream_error_document,  and   subsequent
61       calls to mongoc_change_stream_next will return false.
62

SEE ALSO

64       mongoc_database_watch
65
66       mongoc_collection_watch
67

AUTHOR

69       MongoDB, Inc
70
72       2017-present, MongoDB, Inc
73
74
75
76
771.14.0                           Feb 22, 2019           MONGOC_CLIENT_WATCH(3)
Impressum