title: Gremlin on CosmosDB - Drop and recreate the properties of a vertex without deleting the vertex
body: <p>I am trying to set properties on a vertex in a <em>partitioned</em> CosmosDB graph.
  If the vertex had any properties previously, I want them scrubbed and replaced with the new set of properties. </p>
  
  <p>Even the deleting was a bit tricky, as the 'partition key' is exposed as a non-deleteable property.</p>
  
  <pre><code>g.V('nodeId').has('partitionKey','xx').properties().drop()
  </code></pre>
  
  <p>-> "Gremlin Query Execution Error: The partition property cannot be removed."</p>
  
  <p>Fortunately, the <code>id</code> of the partition key property is predictable and can be used for filtering it out:</p>
  
  <pre><code>g.V('nodeId').has('partitionKey','xx')
  .properties().not(has('id', 'nodeId|partitionKey'))
  .drop()
  </code></pre>
  
  <p>Now I'm stuck trying to add the new properties. I tried:</p>
  
  <pre><code>g.V('nodeId').has('partitionKey','xx')
  .properties().not(has('id', 'nodeId|partitionKey'))
  .drop()
  .property('a','valA')
  .property('b','valB')
  </code></pre>
  
  <p>but that looks like I'm applying the <code>property()</code> step to a (empty) list of properties, not to a vertex.
  The error isn't very helpful:</p>
  
  <pre><code>Gremlin Query Compilation Error: Column reference R_200324["_value"] cannot be located in the raw records in the current execution pipeline.
  </code></pre>
  
  <p>I tried using applying the <code>property()</code> step to the vertex (by <code>select</code>-ing it), but I must be doing something wrong:</p>
  
  <pre><code>g.V('nodeId').has('partitionKey','xx')
  .as('v') 
  .properties().not(has('id', 'nodeId|partitionKey'))
  .drop()
  .select('v')
  .property('a','valA')
  .property('b','valB')
  </code></pre>
  
  <p>This gives the same error as above.</p>
  
  <p>I also tried <code>.back('v')</code> instead of <code>.select('v')</code> but it looks like <code>back</code> is not supported in CosmosDB.</p>
  
  <p>Any suggestions? </p>