case class FindObservable[TResult](wrapped: FindIterable[TResult]) extends Observable[TResult] with Product with Serializable
Observable interface for Find.
- TResult
The type of the result.
- wrapped
the underlying java FindObservable
- Since
1.0
- Alphabetic
- By Inheritance
- FindObservable
- Serializable
- Product
- Equals
- Observable
- Observable
- AnyRef
- Any
- Hide All
- Show All
- Public
- All
Instance Constructors
- new FindObservable(wrapped: FindIterable[TResult])
- wrapped
the underlying java FindObservable
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): FindObservable[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
- Since
2.7
- def clone(): AnyRef
- Attributes
- protected[java.lang]
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.CloneNotSupportedException]) @native()
- def collation(collation: Collation): FindObservable[TResult]
Sets the collation options
Sets the collation options
- collation
the collation options to use
- returns
this
- Since
1.2
- Note
A null value represents the server default.
,Requires MongoDB 3.4 or greater
- def comment(comment: String): FindObservable[TResult]
Sets the comment to the query.
Sets the comment to the query. A null value means no comment is set.
- comment
the comment
- returns
this
- Since
2.2
- def cursorType(cursorType: CursorType): FindObservable[TResult]
Sets the cursor type.
Sets the cursor type.
- cursorType
the cursor type
- returns
this
- final def eq(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
- def filter(filter: Bson): FindObservable[TResult]
Sets the query filter to apply to the query.
Sets the query filter to apply to the query.
- filter
the filter, which may be null.
- returns
this
- def finalize(): Unit
- Attributes
- protected[java.lang]
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.Throwable])
- def first(): SingleObservable[TResult]
Helper to return a Observable limited to just the first result the query.
Helper to return a Observable limited to just the first result the query.
**Note:** Sets limit in the background so only returns 1.
- returns
a Observable which will return the first item
- final def getClass(): Class[_ <: AnyRef]
- Definition Classes
- AnyRef → Any
- Annotations
- @native()
- def hint(hint: Bson): FindObservable[TResult]
Sets the hint for which index to use.
Sets the hint for which index to use. A null value means no hint is set.
- hint
the hint
- returns
this
- Since
2.2
- def hintString(hint: String): FindObservable[TResult]
Sets the hint to apply.
Sets the hint to apply.
Note: If hint is set that will be used instead of any hint string.
- hint
the name of the index which should be used for the operation
- returns
this
- Since
2.8
- final def isInstanceOf[T0]: Boolean
- Definition Classes
- Any
- def limit(limit: Int): FindObservable[TResult]
Sets the limit to apply.
Sets the limit to apply.
- limit
the limit, which may be null
- returns
this
- def max(max: Bson): FindObservable[TResult]
Sets the exclusive upper bound for a specific index.
Sets the exclusive upper bound for a specific index. A null value means no max is set.
- max
the max
- returns
this
- Since
2.2
- def maxAwaitTime(duration: Duration): FindObservable[TResult]
The maximum amount of time for the server to wait on new documents to satisfy a tailable cursor query.
The maximum amount of time for the server to wait on new documents to satisfy a tailable cursor query. This only applies to a TAILABLE_AWAIT cursor. When the cursor is not a TAILABLE_AWAIT cursor, this option is ignored.
On servers >= 3.2, this option will be specified on the getMore command as "maxTimeMS". The default is no value: no "maxTimeMS" is sent to the server with the getMore command.
On servers < 3.2, this option is ignored, and indicates that the driver should respect the server's default value
A zero value will be ignored.
- duration
the duration
- returns
the maximum await execution time in the given time unit
- Since
1.1
- def maxTime(duration: Duration): FindObservable[TResult]
Sets the maximum execution time on the server for this operation.
Sets the maximum execution time on the server for this operation.
- duration
the duration
- returns
this
- def min(min: Bson): FindObservable[TResult]
Sets the minimum inclusive lower bound for a specific index.
Sets the minimum inclusive lower bound for a specific index. A null value means no max is set.
- min
the min
- returns
this
- Since
2.2
- final def ne(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
- def noCursorTimeout(noCursorTimeout: Boolean): FindObservable[TResult]
The server normally times out idle cursors after an inactivity period (10 minutes) to prevent excess memory use.
The server normally times out idle cursors after an inactivity period (10 minutes) to prevent excess memory use. Set this option to prevent that.
- noCursorTimeout
true if cursor timeout is disabled
- returns
this
- final def notify(): Unit
- Definition Classes
- AnyRef
- Annotations
- @native()
- final def notifyAll(): Unit
- Definition Classes
- AnyRef
- Annotations
- @native()
- def oplogReplay(oplogReplay: Boolean): FindObservable[TResult]
Users should not set this under normal circumstances.
Users should not set this under normal circumstances.
- oplogReplay
if oplog replay is enabled
- returns
this
- def partial(partial: Boolean): FindObservable[TResult]
Get partial results from a sharded cluster if one or more shards are unreachable (instead of throwing an error).
Get partial results from a sharded cluster if one or more shards are unreachable (instead of throwing an error).
- partial
if partial results for sharded clusters is enabled
- returns
this
- def productElementNames: Iterator[String]
- Definition Classes
- Product
- def projection(projection: Bson): FindObservable[TResult]
Sets a document describing the fields to return for all matching documents.
Sets a document describing the fields to return for all matching documents.
- projection
the project document, which may be null.
- returns
this
- def returnKey(returnKey: Boolean): FindObservable[TResult]
Sets the returnKey.
Sets the returnKey. If true the find operation will return only the index keys in the resulting documents.
- returnKey
the returnKey
- returns
this
- Since
2.2
- def showRecordId(showRecordId: Boolean): FindObservable[TResult]
Sets the showRecordId.
Sets the showRecordId. Set to true to add a field
$recordId
to the returned documents.- showRecordId
the showRecordId
- returns
this
- Since
2.2
- def skip(skip: Int): FindObservable[TResult]
Sets the number of documents to skip.
Sets the number of documents to skip.
- skip
the number of documents to skip
- returns
this
- def sort(sort: Bson): FindObservable[TResult]
Sets the sort criteria to apply to the query.
Sets the sort criteria to apply to the query.
- sort
the sort criteria, which may be null.
- returns
this
- def subscribe(observer: Observer[_ >: 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
- FindObservable → Observable
- def subscribe(observer: com.mongodb.async.client.Observer[_ >: 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()
Deprecated Value Members
- def maxScan(maxScan: Long): FindObservable[TResult]
Sets the maximum number of documents or index keys to scan when executing the query.
Sets the maximum number of documents or index keys to scan when executing the query.
A zero value or less will be ignored, and indicates that the driver should respect the server's default value.
- maxScan
the maxScan
- returns
this
- Annotations
- @deprecated
- Deprecated
(Since version 2.4) Deprecated as of MongoDB 4.0 release
- Since
2.2
- def modifiers(modifiers: Bson): FindObservable[TResult]
Sets the query modifiers to apply to this operation.
Sets the query modifiers to apply to this operation.
- modifiers
the query modifiers to apply, which may be null.
- returns
this
- Annotations
- @deprecated
- Deprecated
(Since version 2.2) use the individual setters instead
- def snapshot(snapshot: Boolean): FindObservable[TResult]
Sets the snapshot.
Sets the snapshot.
If true it prevents the cursor from returning a document more than once because of an intervening write operation.
- snapshot
the snapshot
- returns
this
- Annotations
- @deprecated
- Deprecated
(Since version 2.4) Deprecated in MongoDB 3.6 release and removed in MongoDB 4.0 release
- Since
2.2
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: