case class ChangeStreamObservable[TResult](wrapped: ChangeStreamIterable[TResult]) extends Observable[ChangeStreamDocument[TResult]] with Product with Serializable
Observable for change streams.
Note: The ChangeStreamDocument
class will not be applicable for all change stream outputs.
If using custom pipelines that radically change the result, the the ChangeStreamObservable#withDocumentClass method should be used
to provide an alternative document format.
- TResult
The type of the result.
- wrapped
the underlying java ChangeStreamIterable
- Since
2.2
- Note
Requires MongoDB 3.6 or greater
- Alphabetic
- By Inheritance
- ChangeStreamObservable
- Serializable
- Product
- Equals
- Observable
- Observable
- AnyRef
- Any
- Hide All
- Show All
- Public
- Protected
Instance Constructors
- new ChangeStreamObservable(wrapped: ChangeStreamIterable[TResult])
- wrapped
the underlying java ChangeStreamIterable
Value Members
- final def !=(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
- final def ##(): Int
- Definition Classes
- AnyRef → Any
- final def ==(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
- final def asInstanceOf[T0]: T0
- Definition Classes
- Any
- def batchSize(batchSize: Int): ChangeStreamObservable[TResult]
Sets the number of documents to return per batch.
Sets the number of documents to return per batch.
- batchSize
the batch size
- returns
this
- def clone(): AnyRef
- Attributes
- protected[lang]
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.CloneNotSupportedException]) @native()
- def collation(collation: Collation): ChangeStreamObservable[TResult]
Sets the collation options
Sets the collation options
A null value represents the server default.
- collation
the collation options to use
- returns
this
- final def eq(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
- def finalize(): Unit
- Attributes
- protected[lang]
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.Throwable])
- def fullDocument(fullDocument: FullDocument): ChangeStreamObservable[TResult]
Sets the fullDocument value.
Sets the fullDocument value.
- fullDocument
the fullDocument
- returns
this
- final def getClass(): Class[_ <: AnyRef]
- Definition Classes
- AnyRef → Any
- Annotations
- @native()
- final def isInstanceOf[T0]: Boolean
- Definition Classes
- Any
- def maxAwaitTime(duration: Duration): ChangeStreamObservable[TResult]
Sets the maximum await execution time on the server for this operation.
Sets the maximum await execution time on the server for this operation.
- duration
the duration
- returns
this
- final def ne(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
- final def notify(): Unit
- Definition Classes
- AnyRef
- Annotations
- @native()
- final def notifyAll(): Unit
- Definition Classes
- AnyRef
- Annotations
- @native()
- def productElementNames: Iterator[String]
- Definition Classes
- Product
- def resumeAfter(resumeToken: Document): ChangeStreamObservable[TResult]
Sets the logical starting point for the new change stream.
Sets the logical starting point for the new change stream.
- resumeToken
the resume token
- returns
this
- def startAfter(startAfter: Document): ChangeStreamObservable[TResult]
Sets the logical starting point for the new change stream.
Sets the logical starting point for the new change stream.
This will allow users to watch collections that have been dropped and recreated or newly renamed collections without missing any notifications.
- startAfter
the resume token
- returns
this
- Since
2.7
- Note
Requires MongoDB 4.2 or greater
,The server will report an error if both
startAfter
andresumeAfter
are specified.- See also
- def startAtOperationTime(startAtOperationTime: BsonTimestamp): ChangeStreamObservable[TResult]
The change stream will only provide changes that occurred at or after the specified timestamp.
The change stream will only provide 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. The default value is an operation time obtained from the server before the change stream was created.
- startAtOperationTime
the start at operation time
- returns
this
- Since
2.4
- Note
Requires MongoDB 4.0 or greater
- def subscribe(observer: Observer[_ >: ChangeStreamDocument[TResult]]): Unit
Request
Observable
to start streaming data.Request
Observable
to start streaming data.This is a "factory method" and can be called multiple times, each time starting a new Subscription. Each
Subscription
will work for only a single Observer.If the
Observable
rejects the subscription attempt or otherwise fails it will signal the error via Observer.onError.- observer
the
Observer
that will consume signals from thisObservable
- Definition Classes
- ChangeStreamObservable → Observable
- def subscribe(observer: com.mongodb.async.client.Observer[_ >: ChangeStreamDocument[TResult]]): Unit
Handles the automatic boxing of a Java
Observable
so it conforms to the interface.Handles the automatic boxing of a Java
Observable
so it conforms to the interface.- observer
the
Observer
that will consume signals from thisObservable
- Definition Classes
- Observable → Observable
- Note
Users should not have to implement this method but rather use the Scala
Observable
.
- final def synchronized[T0](arg0: => T0): T0
- Definition Classes
- AnyRef
- final def wait(): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.InterruptedException])
- final def wait(arg0: Long, arg1: Int): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.InterruptedException])
- final def wait(arg0: Long): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.InterruptedException]) @native()
- def withDocumentClass[T](clazz: Class[T]): Observable[T]
Returns an
Observable
containing the results of the change stream based on the document class provided.Returns an
Observable
containing the results of the change stream based on the document class provided.- T
the result type
- clazz
the class to use for the raw result.
- returns
an Observable
This is the documentation for the MongoDB Scala driver.
Driver structure
The mongodb scala driver.
To get started you need a MongoClient instance, either from a connection string or via a org.mongodb.scala.MongoClientSettings.
Notable packages include: