1MONGOC_COLLECTION_WATCH(3) MongoDB C Driver MONGOC_COLLECTION_WATCH(3)
2
3
4
6 mongoc_collection_watch - mongoc_collection_watch()
7
9 mongoc_change_stream_t*
10 mongoc_collection_watch (const mongoc_collection_t *coll,
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 collec‐
18 tion. If the change stream needs to re-establish connection, the same
19 read preference will be used. This may happen if the change stream
20 encounters a resumable error.
21
22 WARNING:
23 A change stream is only supported with majority read concern.
24
26 · coll: A mongoc_collection_t specifying the collection which the
27 change stream 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 or NULL.
33
34 opts may be NULL or a document consisting of any subset of the follow‐
35 ing parameters:
36
37 · batchSize An int32 representing number of documents requested to be
38 returned on each call to mongoc_change_stream_next
39
40 · resumeAfter A Document representing the logical starting point of the
41 change stream. The _id field of any change received from a change
42 stream can be used here.
43
44 · startAtOperationTime A Timestamp. The change stream only provides
45 changes that occurred at or after the specified timestamp. Any com‐
46 mand run against the server will return an operation time that can be
47 used here.
48
49 · maxAwaitTimeMS An int64 representing the maximum amount of time a
50 call to mongoc_change_stream_next will block waiting for data
51
52 · collation A Collation Document
53
55 A newly allocated mongoc_change_stream_t which must be freed with mon‐
56 goc_change_stream_destroy when no longer in use. The returned mon‐
57 goc_change_stream_t is never NULL. If there is an error, it can be
58 retrieved with mongoc_change_stream_error_document, and subsequent
59 calls to mongoc_change_stream_next will return false.
60
62 mongoc_client_watch
63
64 mongoc_database_watch
65
67 MongoDB, Inc
68
70 2017-present, MongoDB, Inc
71
72
73
74
751.13.1 Jan 24, 2019 MONGOC_COLLECTION_WATCH(3)