What is the effect of the string value at initialization to get data from FirebaseFirestore?

I initialize to get data from FirebaseFirestore, before I thought these two values must be the same to get data. But today I tried the wrong code (ex: data["fromId"]->data["123"], data["toId"]->data["abc"], data["text"]->data["ABC"]) and was very surprised that it still get the data successfully. Anyone can help explain this, what happened?

#I define the "Message" in the "Model" design pattern:

import SwiftUI
import Firebase

struct Message: Identifiable {

var id: String

let fromId, toId, text: String
let timestamp: Timestamp

init(data: [String: Any]) {
    self.id = UUID().uuidString
    self.fromId = data["123"] as? String ?? ""
    self.toId = data["abc"] as? String ?? ""
    self.text = data["ABC"] as? String ?? ""
    self.timestamp = data["timestamp"] as! Timestamp  

#I define "getMessage" function in the "ViewModel" design pattern:

import SwiftUI
import Firebase

class HomeViewModel: ObservableObject {

@Published var alertMessage : String = ""
@Published var allMessage = [Message]()

//MARK: - getMessage
func getMessage(selectedUser: User?) {

    guard let fromId = FirebaseManager.shared.auth.currentUser?.uid else { return }
    guard let toId = selectedUser?.uid else { return }
        .getDocuments { documentSnapshot, error in
            if let error = error {
                self.alertMessage = error.localizedDescription
            documentSnapshot?.documents.forEach({ snapshot in
                let data = snapshot.data()
                self.allMessage.append(.init(data: data))

#Message structure on FirebaseFirestore looks like this:

fromId: "oik4Zjgd6APQEl1dhVE9EplOpSz2"
text: "Did you call me?"
timestamp: November 23, 2021 at 1:05:22 PM UTC+7
toId: "5qlPNV9Z71MEMmnZuT2m3RVzEkJ3"
How many English words
do you know?
Test your English vocabulary size, and measure
how many words do you know
Online Test
Powered by Examplum