Last active
April 4, 2018 12:36
-
-
Save Obbut/d7b465203c16399e2d2b8901aebea4b3 to your computer and use it in GitHub Desktop.
BSON crash
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import BSON | |
struct Henk : Codable { | |
struct Location : Codable { | |
var name = "JFdkljfds" | |
var street = "Harrieboblaan 1" | |
var postalCode = "1234 AB" | |
} | |
var _id = ObjectId() | |
var description: String? = nil | |
var location = Location() | |
} | |
let encoder = BSONEncoder() | |
var document = try! encoder.encode(Henk()) | |
document["location", "name"] = nil | |
document["location", "street"] = nil | |
// Error while parsing BSON document: element type unknown at position 51. | |
// Doesn't happen when you create a new Document with the same data – probably a caching issue |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment