无法在Azure Portal中更新CosmosDB存储过程

时间:2019-08-08 04:07:32

标签: azure azure-cosmosdb

仅从CosmosDB开始。我试图在Azure门户(数据资源管理器)中为CosmosDB数据编写存储过程。我能够创建一个新的存储过程并执行它,但是我无法保存对该过程的任何更改。尝试时,出现以下错误消息:

import React from 'react';
import { Admin, Resource } from 'react-admin';
import Dashboard from './Dashboard';
import hasuraDataProvider from 'ra-data-hasura';
import authProvider from './authProvider';
import {useCookies} from "react-cookie";
import { AssociadoList, AssociadoShow } from "./Associado";
import portugueseMessages from 'ra-language-portuguese'


const dataProvider = function (authToken) {
  const dataProvider = hasuraDataProvider("http://localhost:8080", { "content-type": "application/json", "Authorization": "Bearer " +  authToken});
  return dataProvider;
}
const messages = {
  'pt': portugueseMessages,
};
const i18nProvider = locale => messages[locale];
function App() {
  const [cookies] = useCookies(['authToken']);
  return (
    <Admin
      dataProvider={dataProvider(cookies.authToken)}
      authProvider={authProvider}
      dashboard={Dashboard}
      locale="pt" i18nProvider={i18nProvider}
    >
      <Resource name="adear.associado" list={AssociadoList} options={{ label: 'Associado' }} show={AssociadoShow} />
    </Admin>
  );
}

export default App;

不确定Error while updating stored procedure testSP: ... Create, update, or delete scripts in direct mode in collections with multiple partitions is not allowed. 是什么意思。我该如何解决?

1 个答案:

答案 0 :(得分:1)

您可以尝试使用 ReplaceStoredProcedureAsync 吗?

try 
{
    await _client.CreateStoredProcedureAsync(...);
} 
catch(DocumentClientException dex) when (dex.StatusCode == HttpStatusCode.Conflict) 
{ 
    await _client.ReplaceStoredProcedureAsync(...);  
} 

相关的thread