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
.
- Value parameters:
- underlying
the underlying BsonDocument which stores the data.
- Companion:
- object
Value members
Concrete methods
Adds all elements produced by a TraversableOnce to this document.
Adds all elements produced by a TraversableOnce to this document.
- Value parameters:
- 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.
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.
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.
- Value parameters:
- 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
Removes all elements produced by an iterator from this document.
Removes all elements produced by an iterator from this document.
- Value parameters:
- xs
the iterator producing the elements to remove.
- Returns:
the document itself
Removes a key from this document.
Removes a key from this document.
- Value parameters:
- key
the key to be removed
- Returns:
the document itself.
Removes two or more elements from this document.
Removes two or more elements from this document.
- Value parameters:
- elems
the remaining elements to remove.
- Returns:
the document itself
Removes all bindings from the document. After this operation has completed the document will be empty.
Removes all bindings from the document. After this operation has completed the document will be empty.
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
Applies a function f
to all elements of this document.
Applies a function f
to all elements of this document.
- Type parameters:
- U
the type parameter describing the result of function
f
. This result will always be ignored. TypicallyU
isUnit
, but this is not necessary.
- Value parameters:
- f
the function that is applied for its side-effect to every element. The result of function
f
is discarded.
- Definition Classes
- IterableOnceOps
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.
- Value parameters:
- 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).
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.
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.
- Value parameters:
- 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.
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.
- Value parameters:
- 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.
Retains only those mappings for which the predicate p
returns true
.
Retains only those mappings for which the predicate p
returns true
.
- Value parameters:
- p
The test predicate
Applies a transformation function to all values contained in this document. The transformation function produces new values from existing keys associated values.
Applies a transformation function to all values contained in this document. The transformation function produces new values from existing keys associated values.
- Value parameters:
- f
the transformation to apply
- Returns:
the document itself.
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.
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.
- Value parameters:
- key
The key to update
- value
The new value
Inherited methods
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.
- Value parameters:
- 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
.- Inherited from:
- BaseDocument (hidden)
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.
- Value parameters:
- elems
the remaining elements to remove.
- Returns:
A new document with the keys removed.
- Inherited from:
- BaseDocument (hidden)
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.
- Value parameters:
- xs
the traversable object consisting of key-value pairs.
- Returns:
a new document with the bindings of this document and those from
xs
.- Inherited from:
- BaseDocument (hidden)
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
.
- Value parameters:
- key
the key
- Returns:
the value associated with the given key, or throws
NoSuchElementException
.- Inherited from:
- BaseDocument (hidden)
- Definition Classes
- StrictOptimizedIterableOps -> IterableOps -> IterableOnceOps
- Inherited from:
- StrictOptimizedIterableOps
Tests whether this map contains a binding for a key
Tests whether this map contains a binding for a key
- Value parameters:
- key
the key
- Returns:
true if there is a binding for key in this document, false otherwise.
- Inherited from:
- BaseDocument (hidden)
- Definition Classes
- StrictOptimizedIterableOps -> IterableOps
- Inherited from:
- StrictOptimizedIterableOps
- Definition Classes
- StrictOptimizedIterableOps -> IterableOps -> IterableOnceOps
- Inherited from:
- StrictOptimizedIterableOps
Filters this document by retaining only keys satisfying a predicate.
Filters this document by retaining only keys satisfying a predicate.
- Value parameters:
- 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
.- Inherited from:
- BaseDocument (hidden)
- Definition Classes
- StrictOptimizedIterableOps -> IterableOps -> IterableOnceOps
- Inherited from:
- StrictOptimizedIterableOps
- Definition Classes
- StrictOptimizedIterableOps -> IterableOps -> IterableOnceOps
- Inherited from:
- StrictOptimizedIterableOps
- Definition Classes
- StrictOptimizedIterableOps -> IterableOps -> IterableOnceOps
- Inherited from:
- StrictOptimizedIterableOps
Optionally returns the value associated with a key.
Optionally returns the value associated with a key.
- Value parameters:
- key
the key we want to lookup
- Returns:
an option value containing the value associated with
key
in this document, orNone
if none exists.- Inherited from:
- BaseDocument (hidden)
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.
- Type parameters:
- B
the result type of the default computation.
- Value parameters:
- 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.- key
the key.
- Returns:
the value associated with
key
if it exists, otherwise the result of thedefault
computation.- Inherited from:
- BaseDocument (hidden)
- Inherited from:
- IterableOps
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
- Inherited from:
- BaseDocument (hidden)
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.
- Inherited from:
- BaseDocument (hidden)
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.
- Inherited from:
- BaseDocument (hidden)
Creates an iterator for all keys.
Creates an iterator for all keys.
- Returns:
an iterator over all keys.
- Inherited from:
- BaseDocument (hidden)
- Definition Classes
- StrictOptimizedIterableOps -> IterableOps -> IterableOnceOps
- Inherited from:
- StrictOptimizedIterableOps
- Definition Classes
- StrictOptimizedIterableOps -> IterableOps
- Inherited from:
- StrictOptimizedIterableOps
- Definition Classes
- StrictOptimizedIterableOps -> IterableOps
- Inherited from:
- StrictOptimizedIterableOps
- Definition Classes
- StrictOptimizedIterableOps -> IterableOps -> IterableOnceOps
- Inherited from:
- StrictOptimizedIterableOps
- Definition Classes
- StrictOptimizedIterableOps -> IterableOps -> IterableOnceOps
- Inherited from:
- StrictOptimizedIterableOps
- Definition Classes
- StrictOptimizedIterableOps -> IterableOps
- Inherited from:
- StrictOptimizedIterableOps
- Definition Classes
- StrictOptimizedIterableOps -> IterableOps -> IterableOnceOps
- Inherited from:
- StrictOptimizedIterableOps
- Definition Classes
- BaseDocument -> Bson
- Inherited from:
- BaseDocument (hidden)
Gets a JSON representation of this document using the given JsonWriterSettings
.
Gets a JSON representation of this document using the given JsonWriterSettings
.
- Value parameters:
- settings
the JSON writer settings
- Returns:
a JSON representation of this document
- Inherited from:
- BaseDocument (hidden)
Gets a JSON representation of this document
Gets a JSON representation of this document
- Returns:
a JSON representation of this document
- Inherited from:
- BaseDocument (hidden)
Returns a string representation of the object.
Returns a string representation of the object.
The default representation is platform dependent.
- Returns:
a string representation of the object.
- Definition Classes
- Iterable -> Any
- Inherited from:
- Iterable
- Definition Classes
- StrictOptimizedIterableOps -> IterableOps
- Inherited from:
- StrictOptimizedIterableOps
- Definition Classes
- StrictOptimizedIterableOps -> IterableOps
- Inherited from:
- StrictOptimizedIterableOps
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.
- Value parameters:
- 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.- Inherited from:
- BaseDocument (hidden)
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.
- Value parameters:
- 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.- Inherited from:
- BaseDocument (hidden)
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.
- Inherited from:
- BaseDocument (hidden)
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.
- Inherited from:
- BaseDocument (hidden)
- Definition Classes
- StrictOptimizedIterableOps -> IterableOps
- Inherited from:
- StrictOptimizedIterableOps
Deprecated and Inherited methods
- Deprecated
[Since version 2.13.0]
Use ++ instead of ++: for collections of type Iterable- Inherited from:
- IterableOps
- Deprecated
[Since version 2.13.0]
`aggregate` is not relevant for sequential collections. Use `foldLeft(z)(seqop)` instead.- Inherited from:
- IterableOnceOps
- Deprecated
[Since version 2.13.0]
Check .knownSize instead of .hasDefiniteSize for more actionable information (see scaladoc for details)- Inherited from:
- IterableOnceOps
- Deprecated
[Since version 2.13.0]
Use coll instead of repr in a collection implementation, use the collection value itself from the outside- Inherited from:
- IterableOps
- Deprecated
[Since version 2.13.0]
Iterable.seq always returns the iterable itself- Inherited from:
- Iterable
- Deprecated
[Since version 2.13.7]
toIterable is internal and will be made protected; its name is similar to `toList` or `toSeq`, but it doesn\'t copy non-immutable collections- Inherited from:
- Iterable
- Deprecated
[Since version 2.13.0]
Use .to(LazyList) instead of .toStream- Inherited from:
- IterableOnceOps
- Deprecated
[Since version 2.13.0]
toTraversable is internal and will be made protected; its name is similar to `toList` or `toSeq`, but it doesn\'t copy non-immutable collections- Inherited from:
- IterableOps