.\" Man page generated from reStructuredText. . .TH "MONGOC_DATABASE_WATCH" "3" "Jun 04, 2021" "1.17.6" "libmongoc" .SH NAME mongoc_database_watch \- mongoc_database_watch() . .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 .. .SH SYNOPSIS .INDENT 0.0 .INDENT 3.5 .sp .nf .ft C mongoc_change_stream_t* mongoc_database_watch (const mongoc_database_t *db, const bson_t *pipeline, const bson_t *opts); .ft P .fi .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 database. 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 \fBmongoc_uri_t\fP) the retry behavior does not apply. .SH PARAMETERS .INDENT 0.0 .IP \(bu 2 \fBdb\fP: A \fBmongoc_database_t\fP specifying the database 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 \fBmongoc_change_stream_next\fP .IP \(bu 2 \fBresumeAfter\fP: A \fBDocument\fP representing the logical starting point of the change stream. The result of \fBmongoc_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 "invalidate" event. The result of \fBmongoc_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 \fBmongoc_change_stream_next\fP will block waiting for data .IP \(bu 2 \fBfullDocument\fP: A UTF\-8 string. Set this option to "updateLookup" to direct the change stream cursor to lookup the most current majority\-committed version of the document associated to an update change stream event. .UNINDENT .SH RETURNS .sp A newly allocated \fBmongoc_change_stream_t\fP which must be freed with \fBmongoc_change_stream_destroy\fP when no longer in use. The returned \fBmongoc_change_stream_t\fP is never \fBNULL\fP\&. If there is an error, it can be retrieved with \fBmongoc_change_stream_error_document\fP, and subsequent calls to \fBmongoc_change_stream_next\fP will return \fBfalse\fP\&. .SH SEE ALSO .sp mongoc_client_watch .sp mongoc_collection_watch .SH AUTHOR MongoDB, Inc .SH COPYRIGHT 2017-present, MongoDB, Inc .\" Generated by docutils manpage writer. .