I am saving server value timestamp as follow:
let data : [String: Any] = ["userId": 9,
"name": "Elon Musk",
"timeCreated": ServerValue.timestamp()]
let doc = firestore.collection("orders").document()
doc.setData(data){ (error) in
}
When looking into Firestore, though I see this:
Is this normal? Shouldn't there be instead a long containing the number of milliseconds since the Unix Epoch?
You're using the Realtime Database notion of server timestamp, which is ServerValue.timestamp. It's essentially a dictionary with the values you showed: {'.sv': 'timestamp'}
. That's not compatible with Firestore.
Instead, you want to use Firestore's notion of server timestamp, which is FieldValue.serverTimestamp(). Also see the very last sample in the documentation here.