The question had the part with replica-set priority in config file mentioned.
“Do the nodes with fresher and latest data have priority in the election? (if the priority in the config is not tampered with)”
As mentioned in the above post the nodes with recent data would be given priority in the election. I would like to quote the below lines alone to be more clear,
However, a lower priority instance can be elected as primary for brief periods even if a higher priority secondary is available.
This lower priority member can have the fresh data. Even though the config file has a lower priority for this node, it can be primary node for brief periods until a node with higher priority copies the op-log entries from the lower priority node.
Replica set members continue to call elections until the highest priority member available becomes primary.
Once the data in both the nodes are synced the back-back elections would help the node with high priority in the config file, win election and become primary.
I hope my understanding is correct. Please correct me if I’m wrong…