public function upsertDoc(string $collectionName, string $docId, array $docOrSubset): void
    {
        if ($this->hasDoc($collectionName, $docId)) {
            $this->updateDoc($collectionName, $docId, $docOrSubset);
        } else {
            $this->addDoc($collectionName, $docId, $docOrSubset);
        }
    }
public function upsertDoc(string $collectionName, string $docId, array $docOrSubset): void
    {
        if ($this->hasDoc($collectionName, $docId)) {
            $this->updateDoc($collectionName, $docId, $docOrSubset);
        } else {
            $this->addDoc($collectionName, $docId, $docOrSubset);
        }
    }
public function upsertDoc ( string $ collectionName , string $ docId , array $ docOrSubset ) : void { if ( $ this -> hasDoc ( $ collectionName , $ docId ) ) { $ this -> updateDoc ( $ collectionName , $ docId , $ docOrSubset ) ; } else { $ this -> addDoc ( $ collectionName , $ docId , $ docOrSubset ) ; } }
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
Same as updateDoc except that doc is added to collection if it does not exist .