.\" Man page generated from reStructuredText. . . .nr rst2man-indent-level 0 . .de1 rstReportMargin \\$1 \\n[an-margin] level \\n[rst2man-indent-level] level margin: \\n[rst2man-indent\\n[rst2man-indent-level]] - \\n[rst2man-indent0] \\n[rst2man-indent1] \\n[rst2man-indent2] .. .de1 INDENT .\" .rstReportMargin pre: . RS \\$1 . nr rst2man-indent\\n[rst2man-indent-level] \\n[an-margin] . nr rst2man-indent-level +1 .\" .rstReportMargin post: .. .de UNINDENT . RE .\" indent \\n[an-margin] .\" old: \\n[rst2man-indent\\n[rst2man-indent-level]] .nr rst2man-indent-level -1 .\" new: \\n[rst2man-indent\\n[rst2man-indent-level]] .in \\n[rst2man-indent\\n[rst2man-indent-level]]u .. .TH "MONGOC_COLLECTION_WATCH" "3" "May 07, 2024" "1.27.1" "libmongoc" .SH SYNOPSIS .INDENT 0.0 .INDENT 3.5 .sp .EX mongoc_change_stream_t* mongoc_collection_watch (const mongoc_collection_t *coll, const bson_t *pipeline, const bson_t *opts) BSON_GNUC_WARN_UNUSED_RESULT; .EE .UNINDENT .UNINDENT .sp A helper function to create a change stream. It is preferred to call this function over using a raw aggregation to create a change stream. .sp This function uses the read preference and read concern of the collection. If the change stream needs to re\-establish connection, the same read preference will be used. This may happen if the change stream encounters a resumable error. .sp \fBWARNING:\fP .INDENT 0.0 .INDENT 3.5 A change stream is only supported with majority read concern. .UNINDENT .UNINDENT .sp This function is considered a retryable read operation. Upon a transient error (a network error, errors due to replica set failover, etc.) the operation is safely retried once. If \fBretryreads\fP is false in the URI (see \fI\%mongoc_uri_t\fP) the retry behavior does not apply. .SH PARAMETERS .INDENT 0.0 .IP \(bu 2 \fBcoll\fP: A \fI\%mongoc_collection_t\fP specifying the collection which the change stream listens to. .IP \(bu 2 \fBpipeline\fP: A \fI\%bson_t\fP representing an aggregation pipeline appended to the change stream. This may be an empty document. .IP \(bu 2 \fBopts\fP: A \fI\%bson_t\fP containing change stream options. .UNINDENT .sp \fBopts\fP may be NULL or a BSON document with additional command options: .INDENT 0.0 .IP \(bu 2 \fBbatchSize\fP: An \fBint32\fP representing number of documents requested to be returned on each call to \fI\%mongoc_change_stream_next()\fP .IP \(bu 2 \fBresumeAfter\fP: A \fBDocument\fP representing the logical starting point of the change stream. The result of \fI\%mongoc_change_stream_get_resume_token()\fP or the \fB_id\fP field of any change received from a change stream can be used here. This option is mutually exclusive with \fBstartAfter\fP and \fBstartAtOperationTime\fP\&. .IP \(bu 2 \fBstartAfter\fP: A \fBDocument\fP representing the logical starting point of the change stream. Unlike \fBresumeAfter\fP, this can resume notifications after an \(dqinvalidate\(dq event. The result of \fI\%mongoc_change_stream_get_resume_token()\fP or the \fB_id\fP field of any change received from a change stream can be used here. This option is mutually exclusive with \fBresumeAfter\fP and \fBstartAtOperationTime\fP\&. .IP \(bu 2 \fBstartAtOperationTime\fP: A \fBTimestamp\fP\&. The change stream only provides changes that occurred at or after the specified timestamp. Any command run against the server will return an operation time that can be used here. This option is mutually exclusive with \fBresumeAfter\fP and \fBstartAfter\fP\&. .IP \(bu 2 \fBmaxAwaitTimeMS\fP: An \fBint64\fP representing the maximum amount of time a call to \fI\%mongoc_change_stream_next()\fP will block waiting for data .IP \(bu 2 \fBfullDocument\fP: An optional UTF\-8 string. Set this option to \(dqdefault\(dq, \(dqupdateLookup\(dq, \(dqwhenAvailable\(dq, or \(dqrequired\(dq, If unset, The string \(dqdefault\(dq is assumed. Set this option to \(dqupdateLookup\(dq to direct the change stream cursor to lookup the most current majority\-committed version of the document associated to an update change stream event. .IP \(bu 2 \fBfullDocumentBeforeChange\fP: An optional UTF\-8 string. Set this option to \(dqwhenAvailable\(dq, \(dqrequired\(dq, or \(dqoff\(dq. When unset, the default value is \(dqoff\(dq. Similar to \(dqfullDocument\(dq, but returns the value of the document before the associated change. .IP \(bu 2 \fBshowExpandedEvents\fP: Set to \fBtrue\fP to return an expanded list of change stream events. Available only on MongoDB versions >=6.0 .IP \(bu 2 \fBcomment\fP: A \fI\%bson_value_t\fP specifying the comment to attach to this command. The comment will appear in log messages, profiler output, and currentOp output. Only string values are supported prior to MongoDB 4.4. .UNINDENT .SH RETURNS .sp A newly allocated \fI\%mongoc_change_stream_t\fP which must be freed with \fI\%mongoc_change_stream_destroy()\fP when no longer in use. The returned \fI\%mongoc_change_stream_t\fP is never \fBNULL\fP\&. If there is an error, it can be retrieved with \fI\%mongoc_change_stream_error_document()\fP, and subsequent calls to \fI\%mongoc_change_stream_next()\fP will return \fBfalse\fP\&. .sp \fBSEE ALSO:\fP .INDENT 0.0 .INDENT 3.5 .nf \fI\%mongoc_client_watch()\fP .fi .sp .nf \fI\%mongoc_database_watch()\fP .fi .sp .UNINDENT .UNINDENT .SH AUTHOR MongoDB, Inc .SH COPYRIGHT 2017-present, MongoDB, Inc .\" Generated by docutils manpage writer. .