case class Document(underlying: BsonDocument) extends BaseDocument[Document] with TraversableLike[(String, BsonValue), Document] with Mutable with Product with Serializable
An mutable 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 a BsonValue
.
- underlying
the underlying BsonDocument which stores the data.
- Alphabetic
- By Inheritance
- Document
- Serializable
- Serializable
- Product
- Equals
- Mutable
- BaseDocument
- Bson
- Traversable
- GenTraversable
- GenericTraversableTemplate
- TraversableLike
- GenTraversableLike
- Parallelizable
- TraversableOnce
- GenTraversableOnce
- FilterMonadic
- HasNewBuilder
- AnyRef
- Any
- Hide All
- Show All
- Public
- All
Instance Constructors
-
new
Document(underlying: BsonDocument)
- underlying
the underlying BsonDocument which stores the data.
Type Members
-
type
Self = Document
- Attributes
- protected[this]
- Definition Classes
- TraversableLike
-
class
WithFilter extends FilterMonadic[A, Repr]
- Definition Classes
- TraversableLike
Value Members
-
final
def
!=(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
-
final
def
##(): Int
- Definition Classes
- AnyRef → Any
-
def
+(elems: CanBeBsonElement*): Document
Creates a new document containing a new key/value and all the existing key/values.
Creates a new document containing a new key/value and all the existing key/values.
Mapping
kv
will override existing mappings from this document with the same key.- elems
the key/value mapping to be added. This can be any valid
(String, BsonValue)
pair that can be transformed into a BsonElement via BsonMagnets.CanBeBsonElement implicits and any BsonTransformers that are in scope.- returns
a new document containing mappings of this document and the mapping
kv
.
- Definition Classes
- BaseDocument
-
def
++[B >: (String, BsonValue), That](that: GenTraversableOnce[B])(implicit bf: CanBuildFrom[Document, B, That]): That
- Definition Classes
- TraversableLike → GenTraversableLike
-
def
++:[B >: (String, BsonValue), That](that: Traversable[B])(implicit bf: CanBuildFrom[Document, B, That]): That
- Definition Classes
- TraversableLike
-
def
++:[B >: (String, BsonValue), That](that: TraversableOnce[B])(implicit bf: CanBuildFrom[Document, B, That]): That
- Definition Classes
- TraversableLike
-
def
++=(elems: CanBeBsonElements): Document
Adds all elements produced by a TraversableOnce to this document.
Adds all elements produced by a TraversableOnce to this document.
- elems
a sequence of key/values that make up the Document. This can be any valid sequence of
(String, BsonValue)
pairs that can be transformed into a sequence of BsonElements via BsonMagnets.CanBeBsonElements implicits and any BsonTransformers that are in scope.- returns
the document itself.
-
def
+=(elems: CanBeBsonElement*): Document
Adds a new key/value pair to this document.
Adds a new key/value pair to this document. If the document already contains a mapping for the key, it will be overridden by the new value.
- elems
the key/value pair. This can be any valid
(String, BsonValue)
pair that can be transformed into a BsonElement via BsonMagnets.CanBeBsonElement implicits and any BsonTransformers that are in scope.- returns
the document itself
-
def
-(elems: String*): Document
Removes one or more elements to this document and returns a new document.
Removes one or more elements to this document and returns a new document.
- elems
the remaining elements to remove.
- returns
A new document with the keys removed.
- Definition Classes
- BaseDocument
-
def
--(xs: GenTraversableOnce[String]): Document
Removes a number of elements provided by a traversable object and returns a new document without the removed elements.
Removes a number of elements provided by a traversable object and returns a new document without the removed elements.
- xs
the traversable object consisting of key-value pairs.
- returns
a new document with the bindings of this document and those from
xs
.
- Definition Classes
- BaseDocument
-
def
--=(xs: TraversableOnce[String]): Document
Removes all elements produced by an iterator from this document.
Removes all elements produced by an iterator from this document.
- xs
the iterator producing the elements to remove.
- returns
the document itself
-
def
-=(elems: String*): Document
Removes two or more elements from this document.
Removes two or more elements from this document.
- elems
the remaining elements to remove.
- returns
the document itself
-
def
-=(key: String): Document
Removes a key from this document.
Removes a key from this document.
- key
the key to be removed
- returns
the document itself.
-
def
/:[B](z: B)(op: (B, (String, BsonValue)) ⇒ B): B
- Definition Classes
- TraversableOnce → GenTraversableOnce
-
def
:\[B](z: B)(op: ((String, BsonValue), B) ⇒ B): B
- Definition Classes
- TraversableOnce → GenTraversableOnce
-
final
def
==(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
-
def
addString(b: StringBuilder): StringBuilder
- Definition Classes
- TraversableOnce
-
def
addString(b: StringBuilder, sep: String): StringBuilder
- Definition Classes
- TraversableOnce
-
def
addString(b: StringBuilder, start: String, sep: String, end: String): StringBuilder
- Definition Classes
- TraversableOnce
-
def
aggregate[B](z: ⇒ B)(seqop: (B, (String, BsonValue)) ⇒ B, combop: (B, B) ⇒ B): B
- Definition Classes
- TraversableOnce → GenTraversableOnce
-
def
apply(underlying: BsonDocument): Document
Creates a new immutable document
Creates a new immutable document
- underlying
the underlying BsonDocument
- returns
a new document
- Attributes
- protected[org.mongodb.scala]
- Definition Classes
- Document → BaseDocument
-
def
apply[TResult <: BsonValue](key: String)(implicit e: DefaultsTo[TResult, BsonValue], ct: ClassTag[TResult]): TResult
Retrieves the value which is associated with the given key or throws a
NoSuchElementException
.Retrieves the value which is associated with the given key or throws a
NoSuchElementException
.- key
the key
- returns
the value associated with the given key, or throws
NoSuchElementException
.
- Definition Classes
- BaseDocument
-
final
def
asInstanceOf[T0]: T0
- Definition Classes
- Any
-
def
clear(): Unit
Removes all bindings from the document.
Removes all bindings from the document. After this operation has completed the document will be empty.
-
def
clone(): AnyRef
- Attributes
- protected[java.lang]
- Definition Classes
- AnyRef
- Annotations
- @native() @throws( ... )
-
def
collect[B, That](pf: PartialFunction[(String, BsonValue), B])(implicit bf: CanBuildFrom[Document, B, That]): That
- Definition Classes
- TraversableLike → GenTraversableLike
-
def
collectFirst[B](pf: PartialFunction[(String, BsonValue), B]): Option[B]
- Definition Classes
- TraversableOnce
-
def
companion: GenericCompanion[Traversable]
- Definition Classes
- Traversable → GenTraversable → GenericTraversableTemplate
-
def
contains(key: String): Boolean
Tests whether this map contains a binding for a key
Tests whether this map contains a binding for a key
- key
the key
- returns
true if there is a binding for key in this document, false otherwise.
- Definition Classes
- BaseDocument
-
def
copy(): Document
Copies the document and creates a new one
Copies the document and creates a new one
- returns
a new document with a copy of the underlying BsonDocument
-
def
copyToArray[B >: (String, BsonValue)](xs: Array[B], start: Int, len: Int): Unit
- Definition Classes
- TraversableLike → TraversableOnce → GenTraversableOnce
-
def
copyToArray[B >: (String, BsonValue)](xs: Array[B]): Unit
- Definition Classes
- TraversableOnce → GenTraversableOnce
-
def
copyToArray[B >: (String, BsonValue)](xs: Array[B], start: Int): Unit
- Definition Classes
- TraversableOnce → GenTraversableOnce
-
def
copyToBuffer[B >: (String, BsonValue)](dest: Buffer[B]): Unit
- Definition Classes
- TraversableOnce
-
def
count(p: ((String, BsonValue)) ⇒ Boolean): Int
- Definition Classes
- TraversableOnce → GenTraversableOnce
-
def
drop(n: Int): Document
- Definition Classes
- TraversableLike → GenTraversableLike
-
def
dropWhile(p: ((String, BsonValue)) ⇒ Boolean): Document
- Definition Classes
- TraversableLike → GenTraversableLike
-
final
def
eq(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
-
def
exists(p: ((String, BsonValue)) ⇒ Boolean): Boolean
- Definition Classes
- TraversableLike → TraversableOnce → GenTraversableOnce
-
def
filter(p: ((String, BsonValue)) ⇒ Boolean): Document
- Definition Classes
- TraversableLike → GenTraversableLike
-
def
filterKeys(p: (String) ⇒ Boolean): Document
Filters this document by retaining only keys satisfying a predicate.
Filters this document by retaining only keys satisfying a predicate.
- p
the predicate used to test keys
- returns
a new document consisting only of those key value pairs of this map where the key satisfies the predicate
p
.
- Definition Classes
- BaseDocument
-
def
filterNot(p: ((String, BsonValue)) ⇒ Boolean): Document
- Definition Classes
- TraversableLike → GenTraversableLike
-
def
finalize(): Unit
- Attributes
- protected[java.lang]
- Definition Classes
- AnyRef
- Annotations
- @throws( classOf[java.lang.Throwable] )
-
def
find(p: ((String, BsonValue)) ⇒ Boolean): Option[(String, BsonValue)]
- Definition Classes
- TraversableLike → TraversableOnce → GenTraversableOnce
-
def
flatMap[B, That](f: ((String, BsonValue)) ⇒ GenTraversableOnce[B])(implicit bf: CanBuildFrom[Document, B, That]): That
- Definition Classes
- TraversableLike → GenTraversableLike → FilterMonadic
-
def
flatten[B](implicit asTraversable: ((String, BsonValue)) ⇒ GenTraversableOnce[B]): Traversable[B]
- Definition Classes
- GenericTraversableTemplate
-
def
fold[A1 >: (String, BsonValue)](z: A1)(op: (A1, A1) ⇒ A1): A1
- Definition Classes
- TraversableOnce → GenTraversableOnce
-
def
foldLeft[B](z: B)(op: (B, (String, BsonValue)) ⇒ B): B
- Definition Classes
- TraversableOnce → GenTraversableOnce
-
def
foldRight[B](z: B)(op: ((String, BsonValue), B) ⇒ B): B
- Definition Classes
- TraversableOnce → GenTraversableOnce
-
def
forall(p: ((String, BsonValue)) ⇒ Boolean): Boolean
- Definition Classes
- TraversableLike → TraversableOnce → GenTraversableOnce
-
def
foreach[U](f: ((String, BsonValue)) ⇒ U): Unit
Applies a function
f
to all elements of this document.Applies a function
f
to all elements of this document.- U
the type parameter describing the result of function
f
. This result will always be ignored. TypicallyU
isUnit
, but this is not necessary.- f
the function that is applied for its side-effect to every element. The result of function
f
is discarded.
- Definition Classes
- Document → GenericTraversableTemplate → TraversableLike → GenTraversableLike → TraversableOnce → GenTraversableOnce → FilterMonadic
-
def
genericBuilder[B]: Builder[B, Traversable[B]]
- Definition Classes
- GenericTraversableTemplate
-
def
get[TResult <: BsonValue](key: String)(implicit e: DefaultsTo[TResult, BsonValue], ct: ClassTag[TResult]): Option[TResult]
Optionally returns the value associated with a key.
Optionally returns the value associated with a key.
- key
the key we want to lookup
- returns
an option value containing the value associated with
key
in this document, orNone
if none exists.
- Definition Classes
- BaseDocument
-
final
def
getClass(): Class[_]
- Definition Classes
- AnyRef → Any
- Annotations
- @native()
-
def
getOrElse[B >: BsonValue](key: String, default: CanBeBsonValue): B
Returns the value associated with a key, or a default value if the key is not contained in the map.
Returns the value associated with a key, or a default value if the key is not contained in the map.
- B
the result type of the default computation.
- key
the key.
- default
The default value in case no binding for
key
is found in the Document. This can be any BsonValue type or any native type that has an implicit BsonTransformer in scope.- returns
the value associated with
key
if it exists, otherwise the result of thedefault
computation.
- Definition Classes
- BaseDocument
-
def
getOrElseUpdate[B](key: String, op: ⇒ B)(implicit transformer: BsonTransformer[B]): BsonValue
If given key is already in this document, returns associated value.
If given key is already in this document, returns associated value.
Otherwise, computes value from given expression
op
, stores with key in document and returns that value.- key
the key to test
- op
the computation yielding the value to associate with
key
, ifkey
is previously unbound.- returns
the value associated with key (either previously or as a result of executing the method).
-
def
groupBy[K](f: ((String, BsonValue)) ⇒ K): Map[K, Document]
- Definition Classes
- TraversableLike → GenTraversableLike
-
def
hasDefiniteSize: Boolean
- Definition Classes
- TraversableLike → TraversableOnce → GenTraversableOnce
-
def
head: (String, BsonValue)
- Definition Classes
- TraversableLike → GenTraversableLike
-
def
headOption: Option[(String, BsonValue)]
- Definition Classes
- TraversableLike → GenTraversableLike
-
def
init: Document
- Definition Classes
- TraversableLike → GenTraversableLike
-
def
inits: Iterator[Document]
- Definition Classes
- TraversableLike
-
def
isEmpty: Boolean
- Definition Classes
- TraversableLike → TraversableOnce → GenTraversableOnce
-
final
def
isInstanceOf[T0]: Boolean
- Definition Classes
- Any
-
final
def
isTraversableAgain: Boolean
- Definition Classes
- TraversableLike → GenTraversableLike → GenTraversableOnce
-
def
iterator: Iterator[(String, BsonValue)]
Creates a new iterator over all key/value pairs in this document
Creates a new iterator over all key/value pairs in this document
- returns
the new iterator
- Definition Classes
- BaseDocument
-
def
keySet: Set[String]
Collects all keys of this document in a set.
Collects all keys of this document in a set.
- returns
a set containing all keys of this document.
- Definition Classes
- BaseDocument
-
def
keys: Iterable[String]
Collects all keys of this document in an iterable collection.
Collects all keys of this document in an iterable collection.
- returns
the keys of this document as an iterable.
- Definition Classes
- BaseDocument
-
def
keysIterator: Iterator[String]
Creates an iterator for all keys.
Creates an iterator for all keys.
- returns
an iterator over all keys.
- Definition Classes
- BaseDocument
-
def
last: (String, BsonValue)
- Definition Classes
- TraversableLike → GenTraversableLike
-
def
lastOption: Option[(String, BsonValue)]
- Definition Classes
- TraversableLike → GenTraversableLike
-
def
map[B, That](f: ((String, BsonValue)) ⇒ B)(implicit bf: CanBuildFrom[Document, B, That]): That
- Definition Classes
- TraversableLike → GenTraversableLike → FilterMonadic
-
def
max[B >: (String, BsonValue)](implicit cmp: Ordering[B]): (String, BsonValue)
- Definition Classes
- TraversableOnce → GenTraversableOnce
-
def
maxBy[B](f: ((String, BsonValue)) ⇒ B)(implicit cmp: Ordering[B]): (String, BsonValue)
- Definition Classes
- TraversableOnce → GenTraversableOnce
-
def
min[B >: (String, BsonValue)](implicit cmp: Ordering[B]): (String, BsonValue)
- Definition Classes
- TraversableOnce → GenTraversableOnce
-
def
minBy[B](f: ((String, BsonValue)) ⇒ B)(implicit cmp: Ordering[B]): (String, BsonValue)
- Definition Classes
- TraversableOnce → GenTraversableOnce
-
def
mkString: String
- Definition Classes
- TraversableOnce → GenTraversableOnce
-
def
mkString(sep: String): String
- Definition Classes
- TraversableOnce → GenTraversableOnce
-
def
mkString(start: String, sep: String, end: String): String
- Definition Classes
- TraversableOnce → GenTraversableOnce
-
final
def
ne(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
-
def
newBuilder: Builder[(String, BsonValue), Document]
Creates a new builder for this collection type.
Creates a new builder for this collection type.
- Definition Classes
- Document → GenericTraversableTemplate → TraversableLike → HasNewBuilder
-
def
nonEmpty: Boolean
- Definition Classes
- TraversableOnce → GenTraversableOnce
-
final
def
notify(): Unit
- Definition Classes
- AnyRef
- Annotations
- @native()
-
final
def
notifyAll(): Unit
- Definition Classes
- AnyRef
- Annotations
- @native()
-
def
par: ParIterable[(String, BsonValue)]
- Definition Classes
- Parallelizable
-
def
parCombiner: Combiner[(String, BsonValue), ParIterable[(String, BsonValue)]]
- Attributes
- protected[this]
- Definition Classes
- TraversableLike → Parallelizable
-
def
partition(p: ((String, BsonValue)) ⇒ Boolean): (Document, Document)
- Definition Classes
- TraversableLike → GenTraversableLike
-
def
product[B >: (String, BsonValue)](implicit num: Numeric[B]): B
- Definition Classes
- TraversableOnce → GenTraversableOnce
-
def
put[B](key: String, value: B)(implicit transformer: BsonTransformer[B]): Option[BsonValue]
Adds a new key/value pair to this document and optionally returns previously bound value.
Adds a new key/value pair to this document and optionally returns previously bound value. If the document already contains a mapping for the key, it will be overridden by the new value.
- key
the key to update
- value
the new value
- returns
an option value containing the value associated with the key before the
put
operation was executed, orNone
ifkey
was not defined in the document before.
-
def
reduce[A1 >: (String, BsonValue)](op: (A1, A1) ⇒ A1): A1
- Definition Classes
- TraversableOnce → GenTraversableOnce
-
def
reduceLeft[B >: (String, BsonValue)](op: (B, (String, BsonValue)) ⇒ B): B
- Definition Classes
- TraversableOnce
-
def
reduceLeftOption[B >: (String, BsonValue)](op: (B, (String, BsonValue)) ⇒ B): Option[B]
- Definition Classes
- TraversableOnce → GenTraversableOnce
-
def
reduceOption[A1 >: (String, BsonValue)](op: (A1, A1) ⇒ A1): Option[A1]
- Definition Classes
- TraversableOnce → GenTraversableOnce
-
def
reduceRight[B >: (String, BsonValue)](op: ((String, BsonValue), B) ⇒ B): B
- Definition Classes
- TraversableOnce → GenTraversableOnce
-
def
reduceRightOption[B >: (String, BsonValue)](op: ((String, BsonValue), B) ⇒ B): Option[B]
- Definition Classes
- TraversableOnce → GenTraversableOnce
-
def
remove(key: String): Option[BsonValue]
Removes a key from this document, returning the value associated previously with that key as an option.
Removes a key from this document, returning the value associated previously with that key as an option.
- key
the key to be removed
- returns
an option value containing the value associated previously with
key
, orNone
ifkey
was not defined in the document before.
-
def
repr: Document
- Definition Classes
- TraversableLike → GenTraversableLike
-
def
retain(p: (String, BsonValue) ⇒ Boolean): Document
Retains only those mappings for which the predicate
p
returnstrue
.Retains only those mappings for which the predicate
p
returnstrue
.- p
The test predicate
-
def
reversed: List[(String, BsonValue)]
- Attributes
- protected[this]
- Definition Classes
- TraversableOnce
-
def
scan[B >: (String, BsonValue), That](z: B)(op: (B, B) ⇒ B)(implicit cbf: CanBuildFrom[Document, B, That]): That
- Definition Classes
- TraversableLike → GenTraversableLike
-
def
scanLeft[B, That](z: B)(op: (B, (String, BsonValue)) ⇒ B)(implicit bf: CanBuildFrom[Document, B, That]): That
- Definition Classes
- TraversableLike → GenTraversableLike
-
def
scanRight[B, That](z: B)(op: ((String, BsonValue), B) ⇒ B)(implicit bf: CanBuildFrom[Document, B, That]): That
- Definition Classes
- TraversableLike → GenTraversableLike
- Annotations
- @migration
- Migration
(Changed in version 2.9.0) The behavior of
scanRight
has changed. The previous behavior can be reproduced with scanRight.reverse.
-
def
seq: Traversable[(String, BsonValue)]
- Definition Classes
- Traversable → GenTraversable → Parallelizable → TraversableOnce → GenTraversableOnce
-
def
size: Int
- Definition Classes
- TraversableOnce → GenTraversableOnce
-
def
sizeHintIfCheap: Int
- Attributes
- protected[scala.collection]
- Definition Classes
- GenTraversableOnce
-
def
slice(from: Int, until: Int): Document
- Definition Classes
- TraversableLike → GenTraversableLike
-
def
span(p: ((String, BsonValue)) ⇒ Boolean): (Document, Document)
- Definition Classes
- TraversableLike → GenTraversableLike
-
def
splitAt(n: Int): (Document, Document)
- Definition Classes
- TraversableLike → GenTraversableLike
-
def
stringPrefix: String
- Definition Classes
- TraversableLike → GenTraversableLike
-
def
sum[B >: (String, BsonValue)](implicit num: Numeric[B]): B
- Definition Classes
- TraversableOnce → GenTraversableOnce
-
final
def
synchronized[T0](arg0: ⇒ T0): T0
- Definition Classes
- AnyRef
-
def
tail: Document
- Definition Classes
- TraversableLike → GenTraversableLike
-
def
tails: Iterator[Document]
- Definition Classes
- TraversableLike
-
def
take(n: Int): Document
- Definition Classes
- TraversableLike → GenTraversableLike
-
def
takeWhile(p: ((String, BsonValue)) ⇒ Boolean): Document
- Definition Classes
- TraversableLike → GenTraversableLike
-
def
thisCollection: Traversable[(String, BsonValue)]
- Attributes
- protected[this]
- Definition Classes
- TraversableLike
-
def
to[Col[_]](implicit cbf: CanBuildFrom[Nothing, (String, BsonValue), Col[(String, BsonValue)]]): Col[(String, BsonValue)]
- Definition Classes
- TraversableLike → TraversableOnce → GenTraversableOnce
-
def
toArray[B >: (String, BsonValue)](implicit arg0: ClassTag[B]): Array[B]
- Definition Classes
- TraversableOnce → GenTraversableOnce
-
def
toBsonDocument[TDocument](documentClass: Class[TDocument], codecRegistry: CodecRegistry): BsonDocument
- Definition Classes
- BaseDocument → Bson
-
def
toBsonDocument: BsonDocument
Returns a copy of the underlying BsonDocument
Returns a copy of the underlying BsonDocument
- Definition Classes
- BaseDocument
-
def
toBuffer[B >: (String, BsonValue)]: Buffer[B]
- Definition Classes
- TraversableOnce → GenTraversableOnce
-
def
toCollection(repr: Document): Traversable[(String, BsonValue)]
- Attributes
- protected[this]
- Definition Classes
- TraversableLike
-
def
toIndexedSeq: IndexedSeq[(String, BsonValue)]
- Definition Classes
- TraversableOnce → GenTraversableOnce
-
def
toIterable: Iterable[(String, BsonValue)]
- Definition Classes
- TraversableOnce → GenTraversableOnce
-
def
toIterator: Iterator[(String, BsonValue)]
- Definition Classes
- TraversableLike → GenTraversableOnce
-
def
toJson(settings: JsonWriterSettings): String
Gets a JSON representation of this document using the given
JsonWriterSettings
.Gets a JSON representation of this document using the given
JsonWriterSettings
.- settings
the JSON writer settings
- returns
a JSON representation of this document
- Definition Classes
- BaseDocument
-
def
toJson(): String
Gets a JSON representation of this document
Gets a JSON representation of this document
- returns
a JSON representation of this document
- Definition Classes
- BaseDocument
-
def
toList: List[(String, BsonValue)]
- Definition Classes
- TraversableOnce → GenTraversableOnce
-
def
toMap[T, U](implicit ev: <:<[(String, BsonValue), (T, U)]): Map[T, U]
- Definition Classes
- TraversableOnce → GenTraversableOnce
-
def
toSeq: Seq[(String, BsonValue)]
- Definition Classes
- TraversableOnce → GenTraversableOnce
-
def
toSet[B >: (String, BsonValue)]: Set[B]
- Definition Classes
- TraversableOnce → GenTraversableOnce
-
def
toStream: Stream[(String, BsonValue)]
- Definition Classes
- TraversableLike → GenTraversableOnce
-
def
toString(): String
- Definition Classes
- TraversableLike → Any
-
def
toTraversable: Traversable[(String, BsonValue)]
- Definition Classes
- TraversableLike → TraversableOnce → GenTraversableOnce
- Annotations
- @deprecatedOverriding( ... , "2.11.0" )
-
def
toVector: Vector[(String, BsonValue)]
- Definition Classes
- TraversableOnce → GenTraversableOnce
-
def
transform[B](f: (String, BsonValue) ⇒ B)(implicit transformer: BsonTransformer[B]): Document
Applies a transformation function to all values contained in this document.
Applies a transformation function to all values contained in this document. The transformation function produces new values from existing keys associated values.
- f
the transformation to apply
- returns
the document itself.
-
def
transpose[B](implicit asTraversable: ((String, BsonValue)) ⇒ GenTraversableOnce[B]): Traversable[Traversable[B]]
- Definition Classes
- GenericTraversableTemplate
- Annotations
- @migration
- Migration
(Changed in version 2.9.0)
transpose
throws anIllegalArgumentException
if collections are not uniformly sized.
-
val
underlying: BsonDocument
- Attributes
- protected[org.mongodb.scala]
- Definition Classes
- Document → BaseDocument
-
def
unzip[A1, A2](implicit asPair: ((String, BsonValue)) ⇒ (A1, A2)): (Traversable[A1], Traversable[A2])
- Definition Classes
- GenericTraversableTemplate
-
def
unzip3[A1, A2, A3](implicit asTriple: ((String, BsonValue)) ⇒ (A1, A2, A3)): (Traversable[A1], Traversable[A2], Traversable[A3])
- Definition Classes
- GenericTraversableTemplate
-
def
update[B](key: String, value: B)(implicit transformer: BsonTransformer[B]): Unit
Adds a new key/value pair to this map.
Adds a new key/value pair to this map. If the document already contains a mapping for the key, it will be overridden by the new value.
- key
The key to update
- value
The new value
-
def
updated(elems: CanBeBsonElement*): Document
Creates a new Document consisting of all key/value pairs of the current document plus a new pair of a given key and value.
Creates a new Document consisting of all key/value pairs of the current document plus a new pair of a given key and value.
- elems
The key/values to add. This can be any valid
(String, BsonValue)
pair that can be transformed into a BsonElement via BsonMagnets.CanBeBsonElement implicits and any BsonTransformers that are in scope.- returns
A fresh immutable document with the binding from
key
tovalue
added to the new document.
- Definition Classes
- BaseDocument
-
def
updated[B](key: String, value: B)(implicit transformer: BsonTransformer[B]): Document
Creates a new Document consisting of all key/value pairs of the current document plus a new pair of a given key and value.
Creates a new Document consisting of all key/value pairs of the current document plus a new pair of a given key and value.
- key
The key to add
- value
The new value
- returns
A fresh immutable document with the binding from
key
tovalue
added to the new document.
- Definition Classes
- BaseDocument
-
def
values: Iterable[BsonValue]
Collects all values of this document in an iterable collection.
Collects all values of this document in an iterable collection.
- returns
the values of this document as an iterable.
- Definition Classes
- BaseDocument
-
def
valuesIterator: Iterator[BsonValue]
Creates an iterator for all values in this document.
Creates an iterator for all values in this document.
- returns
an iterator over all values that are associated with some key in this document.
- Definition Classes
- BaseDocument
-
def
view(from: Int, until: Int): TraversableView[(String, BsonValue), Document]
- Definition Classes
- TraversableLike
-
def
view: TraversableView[(String, BsonValue), Document]
- Definition Classes
- TraversableLike
-
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
- @native() @throws( ... )
-
def
withFilter(p: ((String, BsonValue)) ⇒ Boolean): FilterMonadic[(String, BsonValue), Document]
- Definition Classes
- TraversableLike → FilterMonadic
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: