GQL查询不工作使用gcloud (google-cloud)和node.js



我正在尝试运行以下GQL查询:

function gqlExample(callback) {
  datastore.runQuery({
    gqlQuery: {
      queryString: 'SELECT * FROM Person',
    }
  }).execute(function(err, result) {
    if (!err) {
      // Iterate over the results and return the entities.
      result = (result.batch.entityResults || []).map(
        function(entityResult) {
          return entityResult.entity;
        });
    }
    callback(err, result);
  });
}

我在下面的页面上找到了上面的例子:http://ec2 - 54 - 66 - 129 - 240. - ap -东南- 2. - compute.amazonaws.com/httrack/docs/cloud.google.com/datastore/docs/concepts/gql.html

它指出这是一个有效的node.js示例,但在运行查询时,我得到以下错误:

/Users/xxxx/relay-fullstack/server/data/campaign-datastore.js:245
  }).execute(function (err, result) {
     ^
TypeError: ds.runQuery(...).execute is not a function
    at Object.campaignSearchGql (campaign-datastore.js:265:6)
    at Test.<anonymous> (datastore-test.js:29:16)
    at Test.bound [as _cb] (/Users/xxxx/relay-fullstack/node_modules/tape/lib/test.js:63:32)
    at Test.run (/Users/xxxx/relay-fullstack/node_modules/tape/lib/test.js:82:10)
    at Test.bound [as run] (/Users/xxxx/relay-fullstack/node_modules/tape/lib/test.js:63:32)
    at Immediate.next [as _onImmediate] (/Users/xxxx/relay-fullstack/node_modules/tape/lib/results.js:70:15)
    at tryOnImmediate (timers.js:534:15)
    at processImmediate [as _immediateCallback] (timers.js:514:5)

我正在使用最新版本的google cloud for node:

"google-cloud": "^0.38.3",

有没有人得到GQL查询与gcloud和node正确执行?

这显然是数据存储文档的缓存版本。这些Node.js代码片段使用了一个名为googleapis的库:https://github.com/google/google-api-nodejs-client

另一个库gcloud-node目前不支持GQL

相关内容

  • 没有找到相关文章

最新更新