0
改變對象在Azure的功能,格式我有一個藍色的功能,它負責調用「someStoreprocedure」,並通過REQ爲對象。如何使用Java腳本
此相同REQ插入到了蔚藍的收集
在REQ中的數據如下
`{
"intObjectName" : "JCI-AOMS-SWM",
"aomsOrderReleaseNbr" : "7232046001",
"shipToFaxNbr" : "7325609699",
"50records" : [ {
"aomsLineNbr" : 1,
"planShipPtShipDate" : "20170101",
"product" : {
"name" : "test-product-train",
"productDisplayName" : "test-product-train-display",
"sku" : "TRAIN-SKU",
},
"licenses" : [ {
"productKey" : "productKey-1",
"status" : "not activated"
}, {
"productKey" : "productKey-2",
"status" : "not activated"
},
{
"productKey" : "productKey-3",
"status" : "not activated"
} ]
} ],
"isEntitlementInProgress" : true,
"id" : "1dcf296e-4e2f-b3f5-8117-92a7879e0a9b"
}`
我想將其更改爲類似下面,只有一樣,需要不同的格式發送存儲插入程序。
`{
intObjectName: "JCI-AOMS-SWM"
productKeys: [
{
"productKey" : "productKey-1",
"status" : "not activated"
},
{
"productKey" : "productKey-1",
"status" : "not activated"
},
{
"productKey" : "productKey-1",
"status" : "not activated"
},
]
}`
我的JS代碼低於,
請讓我知道在代碼中修正。
var DocumentDBClient = require('documentdb').DocumentClient;
module.exports = function(context, req) {
var host = "some";
var masterKey = "some=";
var spName = "someStoreprocedure";
var client = "";
client = new DocumentDBClient(host, {
masterKey : masterKey
});
var insertSPLink = "dbs/" + "admin" + "/colls/" + "productsoutput"
+ "/sprocs/" + spName;
client.executeStoredProcedure(insertSPLink,req,function(err, res) {
if (err) {
return callback(statusObj);
} else {
context.log("Success in Insertion");
context.done();
return context;
}
});
};