title: Firestore - Write document with same id more than once per second
body: <p>Updating the same document in Firestore can lead to contention and so it is recommended to only update a document once per second. </p>
  
  <p>What about creating a new document with the same ID and fields? Would it lead to contention if you overwrite the existing document? For example, if you ran this more than once per second (using the same document id):</p>
  
  <pre><code>var ref: DocumentReference? = nil
  ref = db.collection("cities").document("new-city-id").setData(data: [
      "name": "Tokyo",
      "country": "Japan"
  ]) { err in
      if let err = err {
          print("Error adding document: \(err)")
      } else {
          print("Document added with ID: \(ref!.documentID)")
      }
  }
  </code></pre>