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>
Rthismap 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 theothervalue if an entry for the key is not present.default TThe value corresponding to the provided key.default TThe value corresponding to the providedkey, or theothervalue if an entry for the key is not present.Whetherthismap has a value (including null) for the provided key.default MqlBooleanWhetherthismap has a value (including null) for the provided key.Returns a map with the same entries asthismap, but with any keys present in theothermap overwritten with the values of that other map.<R extends MqlValue>
RThe result of passingthisvalue to the provided function.Returns a map with the same entries asthismap, but with the specifiedkeyset to the specifiedvalue.Returns a map with the same entries asthismap, but with the specifiedkeyset 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 tothisvalue.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
Whetherthismap has a value (including null) for the provided key.- Parameters:
key- the key.- Returns:
- the resulting value.
-
has
Whetherthismap 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 theothervalue 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 theothervalue 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 asthismap, but with the specifiedkeyset 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 asthismap, but with the specifiedkeyset 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 asthismap, 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 asthismap, 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 asthismap, but with any keys present in theothermap 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
thismap as a document.- Type Parameters:
R- the resulting type.- Returns:
- the resulting value.
-
passMapTo
The result of passingthisvalue 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 tothisvalue.- Type Parameters:
R- the type of the resulting value.- Parameters:
mapping- the switch mapping.- Returns:
- the resulting value.
- See Also:
-