title: Partition Key Error when running Stored Procedure
body: <p>I am trying to insert a single record into a collection with a partition key of <code>/newpart</code></p>
  <p>Just to make sure I'm interpreting what a partition key is, I'm assuming it is the value as shown here.</p>
  <p><a href="https://i.stack.imgur.com/s4CRm.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/s4CRm.png" alt="enter image description here" /></a></p>
  <p>Within that collection I have a stored procedure called <code>createMyDocument</code> which contains</p>
  <pre><code>function createMyDocument(documentToCreate) {
      var context = getContext();
      var collection = context.getCollection();
  
      var accepted = collection.createDocument(collection.getSelfLink(),
            documentToCreate,
            function (err, documentCreated) {
                if (err) throw new Error('Error' + err.message);
                context.getResponse().setBody(documentCreated.id)
            });
      if (!accepted) return;
  }
  </code></pre>
  <p>I call that via Python with:</p>
  <pre><code>config = {
      'ENDPOINT': 'deleted',
      'MASTERKEY': 'deleted',
      'DOCUMENTDB_DATABASE': 'database',
      'DOCUMENTDB_COLLECTION': 'newup'
  };
  
  client = document_client.DocumentClient(config['ENDPOINT'], {'masterKey': config['MASTERKEY'] ,'DisableSSLVerification' : 'true'  })
  data = {&quot;name&quot;:&quot;Ben&quot;,&quot;age&quot;:30,&quot;city&quot;:&quot;New York&quot;}
  client.ExecuteStoredProcedure('dbs/database/colls/newup/sprocs/createMyDocument', data, {&quot;partitionKey&quot; : &quot;/newpart&quot;})
  </code></pre>
  <p>The error returned is
  <code>Requests originating from scripts cannot reference partition keys other than the one for which client request was submitted</code></p>
  <p>So I'm confused by the error message because the stored procedure is (to my understanding) stored within the collection with a partition key of <code>/newpart</code>. That's the same collection, and therefore the same partition key(?) that I am trying to insert the document into.
  The error suggests otherwise however.</p>