【问题标题】:How to count record in particular (namespace,kind) in google datastore in node.js?如何在node.js的谷歌数据存储中特别计算记录(命名空间,种类)?
【发布时间】:2016-05-04 12:18:32
【问题描述】:

我正在使用 gcloud npm 模块。提前致谢。

我尝试了很多,但没有得到任何东西。

【问题讨论】:

  • 您找到解决方案了吗?我正在寻找但没有找到合适的答案

标签: node.js gcloud google-cloud-datastore


【解决方案1】:

您需要对该实体 Kind 进行查询并计算结果。

var query = ds.createQuery('EntityKind');

ds.runQuery(query, function(err, entities, info){
    if(err) { 
    // deal with error in here
    }

    var total = entities.length;

    // You should check if there are more result 
    // and maybe run the query again until there are no more result

    if (info.moreResults !== gcloud.datastore.NO_MORE_RESULTS) {
        // More result
    }

});

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2020-04-18
    • 1970-01-01
    • 1970-01-01
    • 2014-04-17
    • 2018-02-20
    • 1970-01-01
    • 2011-02-10
    • 1970-01-01
    相关资源
    最近更新 更多