object ReadPreference
The preferred replica set members to which a query or command can be sent.
- Since
1.0
- Alphabetic
- By Inheritance
- ReadPreference
- AnyRef
- Any
- Hide All
- Show All
- Public
- All
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
clone(): AnyRef
- Attributes
- protected[java.lang]
- Definition Classes
- AnyRef
- Annotations
- @throws( ... )
-
final
def
eq(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
-
def
equals(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
-
def
finalize(): Unit
- Attributes
- protected[java.lang]
- Definition Classes
- AnyRef
- Annotations
- @throws( classOf[java.lang.Throwable] )
-
final
def
getClass(): Class[_]
- Definition Classes
- AnyRef → Any
-
def
hashCode(): Int
- Definition Classes
- AnyRef → Any
-
final
def
isInstanceOf[T0]: Boolean
- Definition Classes
- Any
-
final
def
ne(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
-
def
nearest(tagSetList: Seq[TagSet], maxStaleness: Duration): TaggableReadPreference
Gets a read preference that forces reads to the primary or a secondary with one of the given sets of tags.
Gets a read preference that forces reads to the primary or a secondary with one of the given sets of tags. The driver will look for a secondary with each tag set in the given list, stopping after one is found, or the primary if none are available.
- tagSetList
the list of tag sets to limit the list of secondaries to
- maxStaleness
the max allowable staleness of secondaries. The minimum value is either 90 seconds, or the heartbeat frequency plus 10 seconds, whichever is greatest.
- returns
ReadPreference which reads nearest node respective of tags.
- Since
1.2
- Note
Requires MongoDB 3.4 or greater
-
def
nearest(tagSetList: Seq[TagSet]): TaggableReadPreference
Gets a read preference that forces reads to the primary or a secondary with one of the given sets of tags.
Gets a read preference that forces reads to the primary or a secondary with one of the given sets of tags. The driver will look for a secondary with each tag set in the given list, stopping after one is found, or the primary if none are available.
- tagSetList
the list of tag sets to limit the list of secondaries to
- returns
ReadPreference which reads nearest node respective of tags.
-
def
nearest(tagSet: TagSet, maxStaleness: Duration): TaggableReadPreference
Gets a read preference that forces reads to the primary or a secondary with the given set of tags.
Gets a read preference that forces reads to the primary or a secondary with the given set of tags.
- tagSet
the set of tags to limit the list of secondaries to
- maxStaleness
the max allowable staleness of secondaries. The minimum value is either 90 seconds, or the heartbeat frequency plus 10 seconds, whichever is greatest.
- returns
ReadPreference which reads nearest node respective of tags.
- Since
1.2
- Note
Requires MongoDB 3.4 or greater
-
def
nearest(tagSet: TagSet): TaggableReadPreference
Gets a read preference that forces reads to the primary or a secondary with the given set of tags.
Gets a read preference that forces reads to the primary or a secondary with the given set of tags.
- tagSet
the set of tags to limit the list of secondaries to
- returns
ReadPreference which reads nearest node respective of tags.
-
def
nearest(maxStaleness: Duration): ReadPreference
Gets a read preference that forces reads to a primary or a secondary.
Gets a read preference that forces reads to a primary or a secondary.
- maxStaleness
the max allowable staleness of secondaries. The minimum value is either 90 seconds, or the heartbeat frequency plus 10 seconds, whichever is greatest.
- returns
ReadPreference which reads nearest
- Since
1.2
- Note
Requires MongoDB 3.4 or greater
-
def
nearest(): ReadPreference
Gets a read preference that forces reads to a primary or a secondary.
Gets a read preference that forces reads to a primary or a secondary.
- returns
ReadPreference which reads nearest
-
final
def
notify(): Unit
- Definition Classes
- AnyRef
-
final
def
notifyAll(): Unit
- Definition Classes
- AnyRef
-
def
primary(): ReadPreference
Gets a read preference that forces read to the primary.
Gets a read preference that forces read to the primary.
- returns
ReadPreference which reads from primary only
-
def
primaryPreferred(tagSetList: Seq[TagSet], maxStaleness: Duration): TaggableReadPreference
Gets a read preference that forces reads to the primary if available, otherwise to a secondary with one of the given sets of tags.
Gets a read preference that forces reads to the primary if available, otherwise to a secondary with one of the given sets of tags. The driver will look for a secondary with each tag set in the given list, stopping after one is found, or failing if no secondary can be found that matches any of the tag sets in the list.
- tagSetList
the list of tag sets to limit the list of secondaries to
- maxStaleness
the max allowable staleness of secondaries. The minimum value is either 90 seconds, or the heartbeat frequency plus 10 seconds, whichever is greatest.
- returns
ReadPreference which reads primary if available, otherwise a secondary respective of tags.
- Since
1.2
- Note
Requires MongoDB 3.4 or greater
-
def
primaryPreferred(tagSetList: Seq[TagSet]): TaggableReadPreference
Gets a read preference that forces reads to the primary if available, otherwise to a secondary with one of the given sets of tags.
Gets a read preference that forces reads to the primary if available, otherwise to a secondary with one of the given sets of tags. The driver will look for a secondary with each tag set in the given list, stopping after one is found, or failing if no secondary can be found that matches any of the tag sets in the list.
- tagSetList
the list of tag sets to limit the list of secondaries to
- returns
ReadPreference which reads primary if available, otherwise a secondary respective of tags.
-
def
primaryPreferred(tagSet: TagSet, maxStaleness: Duration): TaggableReadPreference
Gets a read preference that forces reads to the primary if available, otherwise to a secondary with the given set of tags.
Gets a read preference that forces reads to the primary if available, otherwise to a secondary with the given set of tags.
- tagSet
the set of tags to limit the list of secondaries to.
- maxStaleness
the max allowable staleness of secondaries. The minimum value is either 90 seconds, or the heartbeat frequency plus 10 seconds, whichever is greatest.
- returns
ReadPreference which reads primary if available, otherwise a secondary respective of tags.
- Since
1.2
- Note
Requires MongoDB 3.4 or greater
-
def
primaryPreferred(tagSet: TagSet): TaggableReadPreference
Gets a read preference that forces reads to the primary if available, otherwise to a secondary with the given set of tags.
Gets a read preference that forces reads to the primary if available, otherwise to a secondary with the given set of tags.
- tagSet
the set of tags to limit the list of secondaries to.
- returns
ReadPreference which reads primary if available, otherwise a secondary respective of tags.
-
def
primaryPreferred(maxStaleness: Duration): ReadPreference
Gets a read preference that forces reads to the primary if available, otherwise to a secondary.
Gets a read preference that forces reads to the primary if available, otherwise to a secondary.
- maxStaleness
the max allowable staleness of secondaries. The minimum value is either 90 seconds, or the heartbeat frequency plus 10 seconds, whichever is greatest.
- returns
ReadPreference which reads primary if available.
- Since
1.2
- Note
Requires MongoDB 3.4 or greater
-
def
primaryPreferred(): ReadPreference
Gets a read preference that forces reads to the primary if available, otherwise to a secondary.
Gets a read preference that forces reads to the primary if available, otherwise to a secondary.
- returns
ReadPreference which reads primary if available.
-
def
secondary(tagSetList: Seq[TagSet], maxStaleness: Duration): TaggableReadPreference
Gets a read preference that forces reads to a secondary with one of the given sets of tags.
Gets a read preference that forces reads to a secondary with one of the given sets of tags. The driver will look for a secondary with each tag set in the given list, stopping after one is found, or failing if no secondary can be found that matches any of the tag sets in the list.
- tagSetList
the list of tag sets to limit the list of secondaries to
- maxStaleness
the max allowable staleness of secondaries. The minimum value is either 90 seconds, or the heartbeat frequency plus 10 seconds, whichever is greatest.
- returns
ReadPreference which reads secondary respective of tags.
- Since
1.2
- Note
Requires MongoDB 3.4 or greater
-
def
secondary(tagSetList: Seq[TagSet]): TaggableReadPreference
Gets a read preference that forces reads to a secondary with one of the given sets of tags.
Gets a read preference that forces reads to a secondary with one of the given sets of tags. The driver will look for a secondary with each tag set in the given list, stopping after one is found, or failing if no secondary can be found that matches any of the tag sets in the list.
- tagSetList
the list of tag sets to limit the list of secondaries to
- returns
ReadPreference which reads secondary respective of tags.
-
def
secondary(tagSet: TagSet, maxStaleness: Duration): TaggableReadPreference
Gets a read preference that forces reads to a secondary with the given set of tags.
Gets a read preference that forces reads to a secondary with the given set of tags.
- tagSet
the set of tags to limit the list of secondaries to
- maxStaleness
the max allowable staleness of secondaries. The minimum value is either 90 seconds, or the heartbeat frequency plus 10 seconds, whichever is greatest.
- returns
ReadPreference which reads secondary respective of tags.
- Since
1.2
- Note
Requires MongoDB 3.4 or greater
-
def
secondary(tagSet: TagSet): TaggableReadPreference
Gets a read preference that forces reads to a secondary with the given set of tags.
Gets a read preference that forces reads to a secondary with the given set of tags.
- tagSet
the set of tags to limit the list of secondaries to
- returns
ReadPreference which reads secondary respective of tags.
-
def
secondary(maxStaleness: Duration): ReadPreference
Gets a read preference that forces reads to a secondary.
Gets a read preference that forces reads to a secondary.
- maxStaleness
the max allowable staleness of secondaries. The minimum value is either 90 seconds, or the heartbeat frequency plus 10 seconds, whichever is greatest.
- returns
ReadPreference which reads secondary.
- Since
1.2
- Note
Requires MongoDB 3.4 or greater
-
def
secondary(): ReadPreference
Gets a read preference that forces reads to a secondary.
Gets a read preference that forces reads to a secondary.
- returns
ReadPreference which reads secondary.
-
def
secondaryPreferred(tagSetList: Seq[TagSet], maxStaleness: Duration): TaggableReadPreference
Gets a read preference that forces reads to a secondary with one of the given sets of tags.
Gets a read preference that forces reads to a secondary with one of the given sets of tags. The driver will look for a secondary with each tag set in the given list, stopping after one is found, or the primary if none are available.
- tagSetList
the list of tag sets to limit the list of secondaries to
- maxStaleness
the max allowable staleness of secondaries. The minimum value is either 90 seconds, or the heartbeat frequency plus 10 seconds, whichever is greatest.
- returns
ReadPreference which reads secondary if available respective of tags, otherwise from primary irrespective of tags.
- Since
1.2
- Note
Requires MongoDB 3.4 or greater
-
def
secondaryPreferred(tagSetList: Seq[TagSet]): TaggableReadPreference
Gets a read preference that forces reads to a secondary with one of the given sets of tags.
Gets a read preference that forces reads to a secondary with one of the given sets of tags. The driver will look for a secondary with each tag set in the given list, stopping after one is found, or the primary if none are available.
- tagSetList
the list of tag sets to limit the list of secondaries to
- returns
ReadPreference which reads secondary if available respective of tags, otherwise from primary irrespective of tags.
-
def
secondaryPreferred(tagSet: TagSet, maxStaleness: Duration): TaggableReadPreference
Gets a read preference that forces reads to a secondary with the given set of tags, or the primary is none are available.
Gets a read preference that forces reads to a secondary with the given set of tags, or the primary is none are available.
- tagSet
the set of tags to limit the list of secondaries to
- maxStaleness
the max allowable staleness of secondaries. The minimum value is either 90 seconds, or the heartbeat frequency plus 10 seconds, whichever is greatest.
- returns
ReadPreference which reads secondary if available respective of tags, otherwise from primary irrespective of tags.
- Since
1.2
- Note
Requires MongoDB 3.4 or greater
-
def
secondaryPreferred(tagSet: TagSet): TaggableReadPreference
Gets a read preference that forces reads to a secondary with the given set of tags, or the primary is none are available.
Gets a read preference that forces reads to a secondary with the given set of tags, or the primary is none are available.
- tagSet
the set of tags to limit the list of secondaries to
- returns
ReadPreference which reads secondary if available respective of tags, otherwise from primary irrespective of tags.
-
def
secondaryPreferred(maxStaleness: Duration): ReadPreference
Gets a read preference that forces reads to a secondary if one is available, otherwise to the primary.
Gets a read preference that forces reads to a secondary if one is available, otherwise to the primary.
- maxStaleness
the max allowable staleness of secondaries. The minimum value is either 90 seconds, or the heartbeat frequency plus 10 seconds, whichever is greatest.
- returns
ReadPreference which reads secondary if available, otherwise from primary.
- Since
1.2
- Note
Requires MongoDB 3.4 or greater
-
def
secondaryPreferred(): ReadPreference
Gets a read preference that forces reads to a secondary if one is available, otherwise to the primary.
Gets a read preference that forces reads to a secondary if one is available, otherwise to the primary.
- returns
ReadPreference which reads secondary if available, otherwise from primary.
-
final
def
synchronized[T0](arg0: ⇒ T0): T0
- Definition Classes
- AnyRef
-
def
toString(): String
- Definition Classes
- AnyRef → Any
-
def
valueOf(name: String, tagSetList: Seq[TagSet], maxStaleness: Duration): TaggableReadPreference
Creates a taggable read preference from the given read preference name and list of tag sets.
Creates a taggable read preference from the given read preference name and list of tag sets.
- name
the name of the read preference
- tagSetList
the list of tag sets
- maxStaleness
the max allowable staleness of secondaries. The minimum value is either 90 seconds, or the heartbeat frequency plus 10 seconds, whichever is greatest.
- returns
the taggable read preference
- Since
1.2
- Note
Requires MongoDB 3.4 or greater
-
def
valueOf(name: String, tagSetList: Seq[TagSet]): TaggableReadPreference
Creates a taggable read preference from the given read preference name and list of tag sets.
Creates a taggable read preference from the given read preference name and list of tag sets.
- name
the name of the read preference
- tagSetList
the list of tag sets
- returns
the taggable read preference
-
def
valueOf(name: String): ReadPreference
Creates a read preference from the given read preference name.
Creates a read preference from the given read preference name.
- name
the name of the read preference
- returns
the read preference
-
final
def
wait(): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws( ... )
-
final
def
wait(arg0: Long, arg1: Int): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws( ... )
-
final
def
wait(arg0: Long): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws( ... )
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: