0
내가 다음 링크의 도움으로 푸른 테이블 스토리지의 연속 토큰을 구현하기 위해 노력하고,푸른 테이블 저장 계속 노드 JS 아래 <a href="https://docs.microsoft.com/en-us/azure/cosmos-db/table-storage-how-to-use-nodejs" rel="nofollow noreferrer">https://docs.microsoft.com/en-us/azure/cosmos-db/table-storage-how-to-use-nodejs</a></p> <p> 내 코드입니다
var nextContinuationToken = null;
var query = new azure.TableQuery()
.select([req.query.DataToShow, 'Timestamp'])
.where('Timestamp ge datetime? and Timestamp lt datetime? and
deviceId eq ?', from, to, deviceSelected);
tableSvc.queryEntities('outTable', query, nextContinuationToken, {
payloadFormat: "application/json;odata=nometadata" }, function (error,
result, response) {
if (!error) {
while(!result.entries){//iterate
if (result.continuationToken) {
nextContinuationToken = result.continuationToken;
}
else
{
console.log("Data is: " + dataArray.length);
res.send(dataArray.reverse());
}
}
}
else{
}
});
수있는 사람에 토큰 하나는 Nodejs에 구현할 올바른 방법을 제안합니까?
var dataArray = [];
fetchAllEntities(null, function() {
res.send(dataArray.reverse());
});
function fetchAllEntities(token, callback) {
var query = new azure.TableQuery()
.select([req.query.DataToShow, 'Timestamp'])
.where('Timestamp ge datetime? and Timestamp lt datetime? and deviceId eq ?', from, to, deviceSelected);
var options = { payloadFormat: "application/json;odata=nometadata" }
tableSvc.queryEntities('outTable', query, token, options, function (error, result, response) {
if (!error) {
dataArray.push.apply(dataArray, result.entries);
var token = result.continuationToken;
if(token) {
fetchAllEntities(token, callback);
} else {
console.log("Data is: " + dataArray.length);
callback();
}
} else {
// ...
}
});
}
가이 코드에 어떤 오류가 있습니까 : –
Hi Gaurav, 프로젝트에서이 코드를 실행 한 후에 데이터를 가져 오지 못했습니다. 해결책을 찾으면서 내가 가정 한대로 반복하고 있습니까? –
코드에서 전혀 반복하지 않습니다. 쿼리와 일치하는 모든 데이터를 보내거나 일부 데이터를받는 즉시 응답을 보내려고합니까? –