code: public function upsertDoc(string $collectionName, string $docId, array $docOrSubset): void
      {
          $doc = $this->getDoc($collectionName, $docId);
  
          if($doc) {
              $this->updateDoc($collectionName, $docId, $docOrSubset);
          } else {
              $this->addDoc($collectionName, $docId, $docOrSubset);
          }
      }
docs: Same as updateDoc except that doc is added to collection if it does not exist.
  
  @param string $collectionName
  @param string $docId
  @param array $docOrSubset
  @throws \Throwable if insert/update did not succeed