Package com.mongodb.client.model.mql
Interface MqlMap<T extends MqlValue>
- Type Parameters:
T
- the type of the entry values
- All Superinterfaces:
MqlValue
A map
value
in the context of the MongoDB Query
Language (MQL). A map is a finite set of
entries
of a certain type.
No entry key is repeated. It is a mapping from keys to values.- Since:
- 4.9.0
-
Method Summary
Modifier and TypeMethodDescription<R extends MqlDocument>
Rthis
map as a document.entries()
The entries of this map as an array.The value corresponding to the provided key.The value corresponding to the providedkey
, or theother
value if an entry for the key is not present.default T
The value corresponding to the provided key.default T
The value corresponding to the providedkey
, or theother
value if an entry for the key is not present.Whetherthis
map has a value (including null) for the provided key.default MqlBoolean
Whetherthis
map has a value (including null) for the provided key.Returns a map with the same entries asthis
map, but with any keys present in theother
map overwritten with the values of that other map.<R extends MqlValue>
RThe result of passingthis
value to the provided function.Returns a map with the same entries asthis
map, but with the specifiedkey
set to the specifiedvalue
.Returns a map with the same entries asthis
map, but with the specifiedkey
set to the specifiedvalue
.<R extends MqlValue>
RswitchMapOn
(Function<Branches<MqlMap<T>>, ? extends BranchesTerminal<MqlMap<T>, ? extends R>> mapping) The result of applying the provided switch mapping tothis
value.Methods inherited from interface com.mongodb.client.model.mql.MqlValue
asString, eq, equals, gt, gte, isArrayOr, isBooleanOr, isDateOr, isDocumentOr, isIntegerOr, isMapOr, isNumberOr, isStringOr, lt, lte, ne, passTo, switchOn
-
Method Details
-
has
Whetherthis
map has a value (including null) for the provided key.- Parameters:
key
- the key.- Returns:
- the resulting value.
-
has
Whetherthis
map has a value (including null) for the provided key.- Parameters:
key
- the key.- Returns:
- the resulting value.
-
get
The value corresponding to the provided key.Warning: The use of this method is an unchecked assertion that the key is present (which may be confirmed via
has(com.mongodb.client.model.mql.MqlString)
). Seeget(MqlString, MqlValue)
for a typesafe variant.- Parameters:
key
- the key.- Returns:
- the value.
-
get
The value corresponding to the provided key.Warning: The use of this method is an unchecked assertion that the key is present (which may be confirmed via
has(com.mongodb.client.model.mql.MqlString)
). Seeget(MqlString, MqlValue)
for a typesafe variant.- Parameters:
key
- the key.- Returns:
- the value.
-
get
The value corresponding to the providedkey
, or theother
value if an entry for the key is not present.- Parameters:
key
- the key.other
- the other value.- Returns:
- the resulting value.
-
get
The value corresponding to the providedkey
, or theother
value if an entry for the key is not present.- Parameters:
key
- the key.other
- the other value.- Returns:
- the resulting value.
-
set
Returns a map with the same entries asthis
map, but with the specifiedkey
set to the specifiedvalue
.This does not affect the original map.
- Parameters:
key
- the key.value
- the value.- Returns:
- the resulting value.
-
set
Returns a map with the same entries asthis
map, but with the specifiedkey
set to the specifiedvalue
.This does not affect the original map.
- Parameters:
key
- the key.value
- the value.- Returns:
- the resulting value.
-
unset
Returns a map with the same entries asthis
map, but which has no entry with the specifiedkey
.This does not affect the original map.
- Parameters:
key
- the key.- Returns:
- the resulting value.
-
unset
Returns a map with the same entries asthis
map, but which has no entry with the specifiedkey
.This does not affect the original map.
- Parameters:
key
- the key.- Returns:
- the resulting value.
-
merge
Returns a map with the same entries asthis
map, but with any keys present in theother
map overwritten with the values of that other map. That is, entries from both this and the other map are merged, with the other map having priority.This does not affect the original map.
- Parameters:
other
- the other map.- Returns:
- the resulting value.
-
entries
The entries of this map as an array. No guarantee is made regarding order.- Returns:
- the resulting value.
- See Also:
-
asDocument
this
map as a document.- Type Parameters:
R
- the resulting type.- Returns:
- the resulting value.
-
passMapTo
The result of passingthis
value to the provided function. Equivalent tof.apply(this)
, and allows lambdas and static, user-defined functions to use the chaining syntax.- Type Parameters:
R
- the type of the resulting value.- Parameters:
f
- the function to apply.- Returns:
- the resulting value.
- See Also:
-
switchMapOn
<R extends MqlValue> R switchMapOn(Function<Branches<MqlMap<T>>, ? extends BranchesTerminal<MqlMap<T>, ? extends R>> mapping) The result of applying the provided switch mapping tothis
value.- Type Parameters:
R
- the type of the resulting value.- Parameters:
mapping
- the switch mapping.- Returns:
- the resulting value.
- See Also:
-