mongoc_database_watch3
Usage
WARNING:
Parameters
- •
-
db: A mongoc_database_t specifying the database which the change stream listens to.
- •
-
pipeline: A bson_t representing an aggregation pipeline appended to the change stream. This may be an empty document.
- •
-
opts: A bson_t containing change stream options.
opts may be NULL or a BSON document with additional command options:
- •
-
batchSize: Anint32representing number of documents requested to be returned on each call to mongoc_change_stream_next()
- •
-
resumeAfter: ADocumentrepresenting the logical starting point of the change stream. The result of mongoc_change_stream_get_resume_token() or the_idfield of any change received from a change stream can be used here. This option is mutually exclusive withstartAfterandstartAtOperationTime.
- •
-
startAfter: ADocumentrepresenting the logical starting point of the change stream. UnlikeresumeAfter, this can resume notifications after an "invalidate" event. The result of mongoc_change_stream_get_resume_token() or the_idfield of any change received from a change stream can be used here. This option is mutually exclusive withresumeAfterandstartAtOperationTime.
- •
-
startAtOperationTime: ATimestamp. 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 withresumeAfterandstartAfter.
- •
-
maxAwaitTimeMS: Anint64representing the maximum amount of time a call to mongoc_change_stream_next() will block waiting for data
- •
-
fullDocument: An optional UTF-8 string. Set this option to "default", "updateLookup", "whenAvailable", or "required", If unset, The string "default" is assumed. 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.
- •
-
fullDocumentBeforeChange: An optional UTF-8 string. Set this option to "whenAvailable", "required", or "off". When unset, the default value is "off". Similar to "fullDocument", but returns the value of the document before the associated change.
- •
-
showExpandedEvents: Set totrueto return an expanded list of change stream events. Available only on MongoDB versions >=6.0
- •
-
comment: A bson_value_t 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.
Returns
A newly allocated mongoc_change_stream_t which must be freed with mongoc_change_stream_destroy() when no longer in use. The returned mongoc_change_stream_t is never NULL. If there is an error, it can be retrieved with mongoc_change_stream_error_document(), and subsequent calls to mongoc_change_stream_next() will return false.
SEE ALSO:
mongoc_client_watch()
mongoc_collection_watch()
History
- Debian 13 (Trixie): the text shown here
- Debian 12 (Bookworm)
- Debian 11 (Bullseye)
- Debian 10 (Buster)