您描述的行为是正常的。事实上,对 NoSQLClient.query 的每次调用都会返回结果集的一部分。使用查询的选项参数中的 迭代结果集QueryResult.continuationKey
,直到结果集用完并且继续键为空。Ci-下面是一个例子
async function runQuery(client, stmt, limit) {
const opt = { limit };
let res;
console.log('Query results:');
do {
// Issue the query
res = await client.query(stmt, opt);
// Each call to NoSQLClient.query returns a portion of the
// result set. Iterate over the result set, using the
// QueryResult.continuationKey in the query's option parameter,
// until the result set is exhausted and continuation key is
// null.
for(let row of res.rows) {
console.log(' %O', row);
}
opt.continuationKey = res.continuationKey;
} while(res.continuationKey != null);
}