title: PartitionKey property in Cosmos DB needs to be a string always?
body: <p>I am serializing and storing the below class object into a Cosmos DB partitioned collection with partition key path "/targetId" set on the collection.</p>
  
  <pre><code>public class DataItem
  {
      [JsonProperty(PropertyName = "id")]
      public string Id { get; set; }
  
      [JsonProperty(PropertyName = "name")]
      public string Name { get; set; }
  
      [JsonProperty(PropertyName = "city")]
      public string City { get; set; }
  
      /// This is my partition key
      [JsonProperty(PropertyName = "targetId")]
      public long TargetId { get; set; }
  }
  </code></pre>
  
  <p>In the above class, when I have the property TagretId as long, I get error the below error:</p>
  
  <pre><code>Requests originating from scripts cannot reference partition keys other 
  than the one for which client request was submitted
  </code></pre>
  
  <p>However, when I change the TargetId property to type "string", it works fine.</p>
  
  <p>Is there any type restrcition on the partition key property while using it with Cosmos DB?</p>
  
  <p><strong>Updated code</strong></p>
  
  <pre><code>List&lt;DataItem&gt; items = GetDataItems();  // This comes from UI as JSON, actually
  var groupedItems = items.GroupBy(x =&gt; x.TargetId);
  foreach (var groupItem in groupedItems)
  {
      // I even tried like below converting to dynamic JSON array. Still got the same exception
      //string argsJson = JsonConvert.SerializeObject(groupItem.ToArray());
      //var args = new dynamic[] { JsonConvert.DeserializeObject&lt;dynamic[]&gt;(argsJson) };
  
      RequestOptions requestOptions = new RequestOptions { PartitionKey = new PartitionKey(groupItem.Key.ToString()) };
  
      var result = await client.ExecuteStoredProcedureAsync&lt;int&gt;(
          UriFactory.CreateStoredProcedureUri(DatabaseId, CollectionId, sprocId),
          requestOptions,
          groupItem.ToList());
  }
  </code></pre>