title: Why does my attempt to PATCH a Firestore record replace the entire document?
body: <p>I'm writing a PHP script using cURL to update a few fields in a Firestore document via the Firestore REST API. My problem is that when I run the script, it's replacing the entire document with the fields I'm trying to update as if it's simply doing a PUT. Can someone help me out with this PHP snippet?</p>
  
  <pre><code>curl_setopt_array($curl, array(
      CURLOPT_RETURNTRANSFER =&gt; true,
      CURLOPT_CUSTOMREQUEST =&gt; 'PATCH',
      CURLOPT_HTTPHEADER =&gt; array('Content-Type: application/json',
          'Content-Length: ' . strlen($json),
          'X-HTTP-Method-Override: PATCH'),
      CURLOPT_URL =&gt; $url . '?key=xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx',
      CURLOPT_USERAGENT =&gt; 'cURL',
      CURLOPT_POSTFIELDS =&gt; $json
  ));
  $response = curl_exec( $curl );
  curl_close( $curl );
  </code></pre>
  
  <p>Is there something obvious I'm missing here to make this be perceived as a PATCH from Firestore? Is there any decent way to find out what Firestore is receiving from my script?</p>