package scala
The MongoDB Scala Driver package
Contains type aliases and companion objects to help when using the Scala API
- Since
1.0
- Alphabetic
- By Inheritance
- scala
- WriteConcernImplicits
- ObservableImplicits
- ClientSessionImplicits
- AnyRef
- Any
- Hide All
- Show All
- Public
- Protected
Package Members
- package bson
The bson package, contains mirrors and companion objects for
Bson
values. - package connection
The connection package contains classes that manage connecting to MongoDB servers.
- package gridfs
- package model
The model package containing models and options that help describe
MongoCollection
operations - package vault
This package contains the Key Vault API
This package contains the Key Vault API
- Since
2.7
Type Members
- case class AggregateObservable[TResult](wrapped: AggregatePublisher[TResult]) extends Observable[TResult] with Product with Serializable
Observable for aggregate
Observable for aggregate
- TResult
The type of the result.
- wrapped
the underlying java AggregateObservable
- Since
1.0
- type AutoEncryptionSettings = com.mongodb.AutoEncryptionSettings
The client-side automatic encryption settings.
The client-side automatic encryption settings. In-use encryption enables an application to specify what fields in a collection must be encrypted, and the driver automatically encrypts commands sent to MongoDB and decrypts responses.
Automatic encryption is an enterprise only feature that only applies to operations on a collection. Automatic encryption is not supported for operations on a database or view and will result in error. To bypass automatic encryption, set bypassAutoEncryption=true in
AutoEncryptionSettings
.Explicit encryption/decryption and automatic decryption is a community feature, enabled with the new
com.mongodb.client.vault.ClientEncryption
type.A MongoClient configured with bypassAutoEncryption=true will still automatically decrypt.
If automatic encryption fails on an operation, use a MongoClient configured with bypassAutoEncryption=true and use ClientEncryption#encrypt to manually encrypt values.
Enabling client side encryption reduces the maximum document and message size (using a maxBsonObjectSize of 2MiB and maxMessageSizeBytes of 6MB) and may have a negative performance impact.
Automatic encryption requires the authenticated user to have the listCollections privilege action.
Supplying an
encryptedFieldsMap
provides more security than relying on an encryptedFields obtained from the server. It protects against a malicious server advertising false encryptedFields.- Since
2.7
- type BulkWriteResult = com.mongodb.bulk.BulkWriteResult
The result of a successful bulk write operation.
- case class ChangeStreamObservable[TResult](wrapped: ChangeStreamPublisher[TResult]) extends Observable[ChangeStreamDocument[TResult]] with Product with Serializable
Observable for change streams.
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 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
- type ClientEncryptionSettings = com.mongodb.ClientEncryptionSettings
The client-side settings for data key creation and explicit encryption.
The client-side settings for data key creation and explicit encryption.
Explicit encryption/decryption is a community feature, enabled with the new
com.mongodb.client.vault.ClientEncryption
type, for which this is the settings.- Since
2.7
- type ClientSession = com.mongodb.reactivestreams.client.ClientSession
A Client Session
A Client Session
- Since
2.4
- trait ClientSessionImplicits extends AnyRef
Extends the Java ClientSession and adds helpers for committing and aborting transactions.
Extends the Java ClientSession and adds helpers for committing and aborting transactions.
Automatically imported into the
org.mongodb.scala
namespace - implicit class ScalaClientSession extends AnyRef
The implicit ClientSession with Scala helpers
The implicit ClientSession with Scala helpers
- Definition Classes
- ClientSessionImplicits
- type ClientSessionOptions = com.mongodb.ClientSessionOptions
Options for creating ClientSessions
Options for creating ClientSessions
- Since
2.2
- type ConnectionString = com.mongodb.ConnectionString
The Connection String
- type CreateIndexCommitQuorum = com.mongodb.CreateIndexCommitQuorum
Represents the commit quorum specifies how many data-bearing members of a replica set, including the primary, must complete the index builds successfully before the primary marks the indexes as ready.
Represents the commit quorum specifies how many data-bearing members of a replica set, including the primary, must complete the index builds successfully before the primary marks the indexes as ready.
- Since
4.1
- case class DistinctObservable[TResult](wrapped: DistinctPublisher[TResult]) extends Observable[TResult] with Product with Serializable
Observable for distinct
Observable for distinct
- TResult
The type of the result.
- wrapped
the underlying java DistinctObservable
- Since
1.0
- type Document = scala.bson.collection.immutable.Document
An immutable Document implementation.
An immutable Document implementation.
A strictly typed
Map[String, BsonValue]
like structure that traverses the elements in insertion order. Unlike native scala maps there is no variance in the value type and it always has to be aBsonValue
. - type DuplicateKeyException = com.mongodb.DuplicateKeyException
Subclass of WriteConcernException representing a duplicate key exception
- case class FindObservable[TResult](wrapped: FindPublisher[TResult]) extends Observable[TResult] with Product with Serializable
Observable interface for Find.
Observable interface for Find.
- TResult
The type of the result.
- wrapped
the underlying java FindObservable
- Since
1.0
- case class ListCollectionNamesObservable(wrapped: ListCollectionNamesPublisher) extends Observable[String] with Product with Serializable
Observable for listing collection names.
Observable for listing collection names.
- wrapped
the underlying java ListCollectionNamesPublisher
- Since
5.0
- case class ListCollectionsObservable[TResult](wrapped: ListCollectionsPublisher[TResult]) extends Observable[TResult] with Product with Serializable
Observable interface for ListCollections
Observable interface for ListCollections
- TResult
The type of the result.
- wrapped
the underlying java ListCollectionsPublisher
- Since
1.0
- case class ListDatabasesObservable[TResult](wrapped: ListDatabasesPublisher[TResult]) extends Observable[TResult] with Product with Serializable
Observable interface for ListDatabases.
Observable interface for ListDatabases.
- TResult
The type of the result.
- wrapped
the underlying java ListDatabasesObservable
- Since
1.0
- case class ListIndexesObservable[TResult](wrapped: ListIndexesPublisher[TResult]) extends Observable[TResult] with Product with Serializable
Observable interface for ListIndexes.
Observable interface for ListIndexes.
- TResult
The type of the result.
- wrapped
the underlying java ListIndexesObservable
- Since
1.0
- case class ListSearchIndexesObservable[TResult](wrapped: ListSearchIndexesPublisher[TResult]) extends Observable[TResult] with Product with Serializable
Observable interface for ListSearchIndexes.
Observable interface for ListSearchIndexes.
- TResult
The type of the result.
- wrapped
the underlying java ListSearchIndexesPublisher
- Since
4.11
- type MongoBulkWriteException = com.mongodb.MongoBulkWriteException
An exception that represents all errors associated with a bulk write operation.
- type MongoChangeStreamException = com.mongodb.MongoChangeStreamException
An exception indicating that a failure occurred when running a
$changeStream
.An exception indicating that a failure occurred when running a
$changeStream
.- Since
2.2
- case class MongoClient(wrapped: com.mongodb.reactivestreams.client.MongoClient) extends MongoCluster with Closeable with Product with Serializable
A client-side representation of a MongoDB cluster.
A client-side representation of a MongoDB cluster. Instances can represent either a standalone MongoDB instance, a replica set, or a sharded cluster. Instance of this class are responsible for maintaining an up-to-date state of the cluster, and possibly cache resources related to this, including background threads for monitoring, and connection pools.
Instance of this class server as factories for MongoDatabase instances.
- wrapped
the underlying java MongoClient
- Since
1.0
- type MongoClientException = com.mongodb.MongoClientException
A base class for exceptions indicating a failure condition with the MongoClient.
- type MongoClientSettings = com.mongodb.MongoClientSettings
Various settings to control the behavior of a
MongoClient
. - class MongoCluster extends AnyRef
The client-side representation of a MongoDB cluster operations.
The client-side representation of a MongoDB cluster operations.
The originating MongoClient is responsible for the closing of resources. If the originator MongoClient is closed, then any operations will fail.
- Since
5.2
- See also
MongoClient
- case class MongoCollection[TResult](wrapped: com.mongodb.reactivestreams.client.MongoCollection[TResult]) extends Product with Serializable
The MongoCollection representation.
The MongoCollection representation.
- TResult
The type that this collection will encode documents from and decode documents to.
- wrapped
the underlying java MongoCollection
- Since
1.0
- type MongoCommandException = com.mongodb.MongoCommandException
An exception indicating that a command sent to a MongoDB server returned a failure.
- type MongoCompressor = com.mongodb.MongoCompressor
Options for creating MongoCompressor
Options for creating MongoCompressor
- Since
2.2
- type MongoConnectionPoolClearedException = com.mongodb.MongoConnectionPoolClearedException
An exception that may happen usually as a result of another thread clearing a connection pool.
An exception that may happen usually as a result of another thread clearing a connection pool. Such clearing usually itself happens as a result of an exception.
- type MongoCredential = com.mongodb.MongoCredential
Represents credentials to authenticate to a MongoDB server,as well as the source of the credentials and the authentication mechanism to use.
- type MongoCursorNotFoundException = com.mongodb.MongoCursorNotFoundException
Subclass of MongoException representing a cursor-not-found exception.
- case class MongoDatabase(wrapped: com.mongodb.reactivestreams.client.MongoDatabase) extends Product with Serializable
The MongoDatabase representation.
The MongoDatabase representation.
- wrapped
the underlying java MongoDatabase
- Since
1.0
- type MongoDriverInformation = com.mongodb.MongoDriverInformation
The MongoDriverInformation class allows driver and library authors to add extra information about their library.
The MongoDriverInformation class allows driver and library authors to add extra information about their library. This information is then available in the MongoD/MongoS logs.
The following metadata can be included when creating a
MongoClient
.- The driver name. Eg:
mongo-scala-driver
- The driver version. Eg:
1.2.0
- Extra platform information. Eg:
Scala 2.11
Note: Library authors are responsible for accepting
MongoDriverInformation
from external libraries using their library. Also all the meta data is limited to 512 bytes and any excess data will be truncated.- Since
1.2
- Note
Requires MongoDB 3.4 or greater
- The driver name. Eg:
- type MongoException = com.mongodb.MongoException
Top level Exception for all Exceptions, server-side or client-side, that come from the driver.
- type MongoExecutionTimeoutException = com.mongodb.MongoExecutionTimeoutException
Exception indicating that the execution of the current operation timed out as a result of the maximum operation time being exceeded.
- type MongoIncompatibleDriverException = com.mongodb.MongoIncompatibleDriverException
An exception indicating that this version of the driver is not compatible with at least one of the servers that it is currently connected to.
- type MongoInternalException = com.mongodb.MongoInternalException
A Mongo exception internal to the driver, not carrying any error code.
- type MongoInterruptedException = com.mongodb.MongoInterruptedException
A non-checked exception indicating that the driver has been interrupted by a call to
Thread.interrupt
. - type MongoNamespace = com.mongodb.MongoNamespace
A MongoDB namespace, which includes a database name and collection name.
- type MongoNodeIsRecoveringException = com.mongodb.MongoNodeIsRecoveringException
An exception indicating that the server is a member of a replica set but is in recovery mode, and therefore refused to execute the operation.
An exception indicating that the server is a member of a replica set but is in recovery mode, and therefore refused to execute the operation. This can happen when a server is starting up and trying to join the replica set.
- type MongoNotPrimaryException = com.mongodb.MongoNotPrimaryException
An exception indicating that the server is a member of a replica set but is not the primary, and therefore refused to execute either a write operation or a read operation that required a primary.
An exception indicating that the server is a member of a replica set but is not the primary, and therefore refused to execute either a write operation or a read operation that required a primary. This can happen during a replica set election.
- type MongoOperationTimeoutException = com.mongodb.MongoOperationTimeoutException
Exception thrown to indicate that a MongoDB operation has exceeded the specified timeout for the full execution of operation.
Exception thrown to indicate that a MongoDB operation has exceeded the specified timeout for the full execution of operation.
The MongoOperationTimeoutException might provide information about the underlying cause of the timeout, if available. For example, if retries are attempted due to transient failures, and a timeout occurs in any of the attempts, the exception from one of the retries may be appended as the cause to this MongoOperationTimeoutException.
- Since
5.0
- type MongoQueryException = com.mongodb.MongoQueryException
An exception indicating that a query operation failed on the server.
- type MongoSecurityException = com.mongodb.MongoSecurityException
This exception is thrown when there is an error reported by the underlying client authentication mechanism.
- type MongoServerException = com.mongodb.MongoServerException
An exception indicating that some error has been raised by a MongoDB server in response to an operation.
- type MongoServerUnavailableException = com.mongodb.MongoServerUnavailableException
Subclass of MongoClientException representing a server-unavailable exception.
- type MongoSocketClosedException = com.mongodb.MongoSocketClosedException
This exception is thrown when trying to read or write from a closed socket.
- type MongoSocketException = com.mongodb.MongoSocketException
Subclass of MongoException representing a network-related exception
- type MongoSocketOpenException = com.mongodb.MongoSocketOpenException
This exception is thrown when there is an exception opening a Socket.
- type MongoSocketReadException = com.mongodb.MongoSocketReadException
This exception is thrown when there is an exception reading a response from a Socket.
- type MongoSocketReadTimeoutException = com.mongodb.MongoSocketReadTimeoutException
This exception is thrown when there is a timeout reading a response from the socket.
- type MongoSocketWriteException = com.mongodb.MongoSocketWriteException
This exception is thrown when there is an exception writing a response to a Socket.
- type MongoSocketWriteTimeoutException = com.mongodb.MongoSocketWriteTimeoutException
This exception is thrown when there is a timeout writing to a socket.
- type MongoTimeoutException = com.mongodb.MongoTimeoutException
An exception indicating that the driver has timed out waiting for either a server or a connection to become available.
- type MongoUpdatedEncryptedFieldsException = com.mongodb.MongoUpdatedEncryptedFieldsException
An exception thrown by methods that may automatically create data encryption keys where needed based on the
encryptedFields
configuration.An exception thrown by methods that may automatically create data encryption keys where needed based on the
encryptedFields
configuration.- Annotations
- @Beta()
- Since
4.9
- type MongoWriteConcernException = com.mongodb.MongoWriteConcernException
An exception indicating a failure to apply the write concern to the requested write operation
An exception indicating a failure to apply the write concern to the requested write operation
- See also
- type MongoWriteException = com.mongodb.MongoWriteException
An exception indicating the failure of a write operation.
- trait Observable[T] extends Publisher[T]
A
Observable
represents a MongoDB operation and implements thePublisher
interface.A
Observable
represents a MongoDB operation and implements thePublisher
interface.As such it is a provider of a potentially unbounded number of sequenced elements, publishing them according to the demand received from its Observer(s).
Extends the
Publisher
interface and adds helpers to make Observables composable and simple to Subscribe to.Special parameterizations:
Observable[Unit]
must emit exactly one item by signalling Observer.onNext if it terminates successfully by signalling Observer.onComplete.Observable[Void]
cannot emit an item. It is not exposed by the driver API because it is not convenient to work with in Scala.
- trait ObservableImplicits extends AnyRef
Implicit conversion support for Publishers, Observables and Subscriptions
Implicit conversion support for Publishers, Observables and Subscriptions
Automatically imported into the
org.mongodb.scala
namespace - implicit class BoxedPublisher[T] extends Observable[T]
- Definition Classes
- ObservableImplicits
- implicit class BoxedSubscriber[T] extends Observer[T]
- Definition Classes
- ObservableImplicits
- implicit class BoxedSubscription extends Subscription
- Definition Classes
- ObservableImplicits
- implicit class ObservableFuture[T] extends AnyRef
- Definition Classes
- ObservableImplicits
- implicit class SingleObservableFuture[T] extends AnyRef
- Definition Classes
- ObservableImplicits
- implicit class ToObservableString extends Observable[String]
- Definition Classes
- ObservableImplicits
- implicit class ToSingleObservableGridFS extends SingleObservable[GridFSFile]
- Definition Classes
- ObservableImplicits
- implicit class ToSingleObservableInt extends SingleObservable[Int]
- Definition Classes
- ObservableImplicits
- implicit class ToSingleObservableLong extends SingleObservable[Long]
- Definition Classes
- ObservableImplicits
- implicit class ToSingleObservableObjectId extends SingleObservable[ObjectId]
- Definition Classes
- ObservableImplicits
- implicit class ToSingleObservablePublisher[T] extends SingleObservable[T]
- Definition Classes
- ObservableImplicits
- implicit class ToSingleObservableUnit extends SingleObservable[Unit]
An Observable that emits
An Observable that emits
- exactly one item, if the wrapped
Publisher
does not signal an error, even if the represented stream is empty; - no items if the wrapped
Publisher
signals an error.
- Definition Classes
- ObservableImplicits
- exactly one item, if the wrapped
- trait Observer[T] extends Subscriber[T]
A Scala based wrapper of the
Subscriber
interface which provides a mechanism for receiving push-based notifications.A Scala based wrapper of the
Subscriber
interface which provides a mechanism for receiving push-based notifications.Will receive a call to
Observer.onSubscribe(subscription: Subscription)
on subscription to the Observable.Default implementations of this trait are greedy and will call Subscription.request with
Long.MaxValue
so that all results are requested. Custom implementations of theonSubscribe
method can be used to control "back-pressure" and ensure that only demand that theObserver
is capable of handling is requested.After signaling demand:
- Zero or more invocations of Observer.onNext up to the maximum number defined by Subscription.request - Single invocation of Observer.onError or Observer.onComplete which signals a terminal state after which no further events will be sent.
- T
The type of element signaled.
- type ReadConcern = com.mongodb.ReadConcern
Controls the level of isolation for reads.
Controls the level of isolation for reads.
- Since
1.1
- type ReadConcernLevel = com.mongodb.ReadConcernLevel
The readConcern option allows clients to choose a level of isolation for their reads.
The readConcern option allows clients to choose a level of isolation for their reads.
- Since
1.1
- See also
- type ReadPreference = com.mongodb.ReadPreference
Represents preferred replica set members to which a query or command can be sent.
- implicit class ScalaWriteConcern[T] extends AnyRef
- Definition Classes
- WriteConcernImplicits
- type ServerAddress = com.mongodb.ServerAddress
Represents the location of a MongoDB server
- trait SingleObservable[T] extends Observable[T]
A
SingleObservable
represents an Observable that emits one or no items.A
SingleObservable
represents an Observable that emits one or no items.- T
the type of element signaled.
- Since
2.0
- trait Subscription extends reactivestreams.Subscription
A
Subscription
represents a one-to-one lifecycle of a Observer subscribing to an Observable.A
Subscription
represents a one-to-one lifecycle of a Observer subscribing to an Observable.Instances can only be used once by a single Observer.
It is used to both signal desire for data and to allow for unsubscribing.
- type Tag = com.mongodb.Tag
A replica set tag
- type TagSet = com.mongodb.TagSet
An immutable set of tags, used to select members of a replica set to use for read operations.
- type TaggableReadPreference = com.mongodb.TaggableReadPreference
Represents ReadPreferences that can be combined with tags
- type TimeoutMode = com.mongodb.client.cursor.TimeoutMode
The timeout mode for a cursor
The timeout mode for a cursor
For operations that create cursors,
timeoutMS
can either cap the lifetime of the cursor or be applied separately to the original operation and all next calls.- Since
5.2
- type TransactionOptions = com.mongodb.TransactionOptions
Options for transactions
Options for transactions
- Since
2.4
- type WriteConcern = com.mongodb.WriteConcern
Controls the acknowledgment of write operations with various options.
- type WriteConcernException = com.mongodb.WriteConcernException
An exception representing an error reported due to a write failure.
- type WriteConcernResult = com.mongodb.WriteConcernResult
The result of a successful write operation.
The result of a successful write operation. If the write was unacknowledged, then
wasAcknowledged
will return false and all other methods with throwMongoUnacknowledgedWriteException
.- See also
- type WriteError = com.mongodb.WriteError
Represents the details of a write error , e.g.
Represents the details of a write error , e.g. a duplicate key error
Deprecated Type Members
- case class MapReduceObservable[TResult](wrapped: MapReducePublisher[TResult]) extends Observable[TResult] with Product with Serializable
Observable for map reduce.
Observable for map reduce.
- Annotations
- @deprecated
- Deprecated
(Since version 4.4.0) Superseded by aggregate
Value Members
- val Document: scala.bson.collection.immutable.Document.type
An immutable Document implementation.
An immutable Document implementation.
A strictly typed
Map[String, BsonValue]
like structure that traverses the elements in insertion order. Unlike native scala maps there is no variance in the value type and it always has to be aBsonValue
. - implicit def bsonDocumentToDocument(doc: BsonDocument): Document
- implicit def bsonDocumentToUntypedDocument(doc: BsonDocument): bson.Document
- implicit def classTagToClassOf[C](ct: ClassTag[C]): Class[C]
Helper to get the class from a classTag
Helper to get the class from a classTag
- C
the class type
- ct
the classTag we want to implicitly get the class of
- returns
the classOf[C]
- implicit def documentToUntypedDocument(doc: Document): bson.Document
- object AutoEncryptionSettings
The client-side automatic encryption settings.
The client-side automatic encryption settings. In-use encryption enables an application to specify what fields in a collection must be encrypted, and the driver automatically encrypts commands sent to MongoDB and decrypts responses.
Automatic encryption is an enterprise only feature that only applies to operations on a collection. Automatic encryption is not supported for operations on a database or view and will result in error. To bypass automatic encryption, set bypassAutoEncryption=true in
AutoEncryptionSettings
.Explicit encryption/decryption and automatic decryption is a community feature, enabled with the new
com.mongodb.client.vault.ClientEncryption
type.A MongoClient configured with bypassAutoEncryption=true will still automatically decrypt.
If automatic encryption fails on an operation, use a MongoClient configured with bypassAutoEncryption=true and use ClientEncryption#encrypt to manually encrypt values.
Enabling client side encryption reduces the maximum document and message size (using a maxBsonObjectSize of 2MiB and maxMessageSizeBytes of 6MB) and may have a negative performance impact.
Automatic encryption requires the authenticated user to have the listCollections privilege action.
Supplying an
encryptedFieldsMap
provides more security than relying on an encryptedFields obtained from the server. It protects against a malicious server advertising false encryptedFields.- Since
2.7
- object ClientEncryptionSettings
The client-side settings for data key creation and explicit encryption.
The client-side settings for data key creation and explicit encryption.
Explicit encryption/decryption is a community feature, enabled with the new
com.mongodb.client.vault.ClientEncryption
type, for which this is the settings.- Since
2.7
- object ClientSessionOptions
The options to apply to a
ClientSession
.The options to apply to a
ClientSession
.- Since
2.2
- See also
ClientSession
- object ConnectionString
Connection String companion object
- object CreateIndexCommitQuorum
The commit quorum specifies how many data-bearing members of a replica set, including the primary, must complete the index builds successfully before the primary marks the indexes as ready.
The commit quorum specifies how many data-bearing members of a replica set, including the primary, must complete the index builds successfully before the primary marks the indexes as ready.
- Since
4.1
- object LoggerSettings
Settings for the logger.
Settings for the logger.
- Since
4.9
- object MongoClient extends Serializable
Companion object for creating new MongoClient instances
Companion object for creating new MongoClient instances
- Since
1.0
- object MongoClientSettings
A MongoClientSettings companion object
A MongoClientSettings companion object
- Since
1.0
- object MongoCluster
Companion object for creating new MongoCluster instances
Companion object for creating new MongoCluster instances
- Since
1.0
- object MongoCompressor
Metadata describing a compressor to use for sending and receiving messages to a MongoDB server.
Metadata describing a compressor to use for sending and receiving messages to a MongoDB server.
- Since
2.2
- Note
Requires MongoDB 3.4 or greater
- object MongoCredential
Represents credentials to authenticate to a MongoDB server, as well as the source of the credentials and the authentication mechanism to use.
Represents credentials to authenticate to a MongoDB server, as well as the source of the credentials and the authentication mechanism to use.
- Since
1.0
- object MongoDriverInformation
The options regarding collation support in MongoDB 3.4+
The options regarding collation support in MongoDB 3.4+
- Since
1.2
- Note
Requires MongoDB 3.4 or greater
- object MongoException
Top level Exception for all Exceptions, server-side or client-side, that come from the driver.
- object MongoNamespace
A companion object for MongoNamespace
A companion object for MongoNamespace
- Since
1.0
- object Observable
A companion object for Observable
- object ReadConcern
The readConcern option allows clients to choose a level of isolation for their reads.
The readConcern option allows clients to choose a level of isolation for their reads.
- Since
1.1
- Note
Requires MongoDB 3.2 or greater
- object ReadConcernLevel
The readConcern level of isolation for reads.
The readConcern level of isolation for reads.
- Since
1.1
- Note
Requires MongoDB 3.2 or greater
- object ReadPreference
The preferred replica set members to which a query or command can be sent.
The preferred replica set members to which a query or command can be sent.
- Since
1.0
- object ServerAddress
Represents the location of a MongoDB server - i.e.
Represents the location of a MongoDB server - i.e. server name and port number
- Since
1.0
- object SingleObservable
A companion object for SingleObservable
A companion object for SingleObservable
- Since
2.0
- object Tag
A replica set tag.
- object TagSet
An immutable set of tags, used to select members of a replica set to use for read operations.
- object TransactionOptions
The options to apply to transactions.
The options to apply to transactions.
- Since
2.4
- See also
TransactionOptions
- object WriteConcern
Controls the acknowledgment of write operations with various options.
Controls the acknowledgment of write operations with various options.
w
- 0: Don't wait for acknowledgement from the server - 1: Wait for acknowledgement, but don't wait for secondaries to replicate - >=2: Wait for one or more secondaries to also acknowledge - "majority": Wait for a majority of secondaries to also acknowledge - "<tag set name>": Wait for one or more secondaries to also acknowledge based on a tag set name
wTimeout
- how long to wait for slaves before failing- 0: indefinite - >0: time to wait in milliseconds
Other options:
-
journal
: If true block until write operations have been committed to the journal. Cannot be used in combination withfsync
. Prior to MongoDB 2.6 this option was ignored if the server was running without journaling. Starting with MongoDB 2.6 write operations will fail with an exception if this option is used when the server is running without journaling.Implicit helper
The ScalaWriteConcern implicit allows for chainable building of the WriteConcern eg:
val myWriteConcern = WriteConcern.ACKNOWLEDGED.withJournal(true)).withWTimeout(Duration(10, TimeUnit.MILLISECONDS))
- Since
1.0
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: