Convert MongoDB TimeStamp To Date

Using realm-cocoa, we’re converting a RLMObject to a NSDictionary and passing that in as one of the arguments to RLMUser callFunctionNamed:arguments:completionBlock: The RLMObject has a property of type NSDate that realm converts to the BSON Timestamp type.

The issue is within the server function, we cant find a way to convert the Timestamp type back to a Date type, which the document the RLMObject pertains to expects. If the property expecting a Date type is set with the Timestamp type, it results in an error;

“Detailed Error: could not convert MongoDB value to Realm payload for { table: X, path: created }, value={1545566585 0} : unsupported BSON type for Realm value primitive.Timestamp”