在nodejs中删除云数据存储中的特定实体

Delete specific entity in cloud datastore in nodejs

我想删除给定用户名、密码等一些属性的特定实体

以下(用于测试我是否可以检索实体)给出了一个无限循环(在云函数中)并打印了一个空对象。

 var query = datastore.createQuery('account')
            .filter('email', '=', req.body.email)
            .filter('token', '=', req.body.token)
            .filter('password', '=', req.body.password);

        datastore.runQuery(query)
            .then((results) => {
                console.log(results[0]);
                var response = JSON.stringify({
                    status: "error",
                    message: results[0]
                });
            })

所以我的问题是:

我如何找到使用属性检索的实体的 ID,为什么我的代码(本应检索该实体)给出了一个空对象(所有过滤器都匹配,至少它们对应于我在云中看到的内容数据存储)?

   datastore.runQuery(query, function(error, entity) {
            if (error){

            } else {
                entityKey = entity[0][datastore.KEY];   <=== This gives you the key of the entity

            }

来源:https://googlecloudplatform.github.io/google-cloud-node/#/docs/datastore/1.1.0/datastore