Details
-
Improvement
-
Status: Closed
-
Minor - P4
-
Resolution: Fixed
-
None
-
None
Description
In many languages (including Swift) there is a way to provide a default value to use for a key that isn't present in a dictionary.
The Swift-y way incorporates the value into the subscript getter:
let value = doc["x", default: 0]
|
See documentation here.
We should consider supporting this on Documents.
Note we will need to think carefully about behavior when there are null values in documents.
Attachments
Issue Links
- depends on
-
SWIFT-193 Improve handling of BSON nulls
-
- Closed
-