Open iMac0de opened 7 years ago
Hi guys,
Some news about this issue, I found out that the problem came from an Enum in my User object.
I need to implement the JSONConvertible protocol to the enum and return the rawValue between double quotes in order to avoid a JSON and a BSON error.
enum Sex: String, Codable, JSONConvertible {
case male = "male"
case female = "female"
case undefined = "undefined"
func jsonEncodedString() throws -> String {
return "\"\(rawValue)\""
}
}
I think you should speak about this in your documentation for BSON.
Thanks.
Hi guys,
I was trying to use MongoDB-StORM but I am facing an issue during with the connection.
I have set my default settings in the main.swift file:
MongoDBConnection.host = "localhost"
MongoDBConnection.port = 27017
MongoDBConnection.ssl = false
MongoDBConnection.database = "mydb"
But when I am trying to save an object, I got this error:
The operation couldn’t be completed. (StORM.StORMError error 0.)
I have tried with PerfectMongoDB directly by creating a client, then the database and then get a collection and I have no error with the same parameters.
Also, I check your code in the MongoDBStORM.swift file and I saw that when you are trying to create a MongoClient you use the MongoDBConnection.host parameter but not the MongoDBConnection.port parameter, so maybe the problem is from there.
Thanks.