Node.js 如何在google数据存储查询过滤器中处理浮点?
我一直在与Google数据存储合作,试图将查询从SQL数据库迁移到数据存储。我在Node中工作,并尝试在一个类中的实体上进行筛选 此实体具有以下字段Node.js 如何在google数据存储查询过滤器中处理浮点?,node.js,google-app-engine,floating-point,google-cloud-datastore,google-cloud-platform,Node.js,Google App Engine,Floating Point,Google Cloud Datastore,Google Cloud Platform,我一直在与Google数据存储合作,试图将查询从SQL数据库迁移到数据存储。我在Node中工作,并尝试在一个类中的实体上进行筛选 此实体具有以下字段 Exchange: String Threshold: Floating Point Number Pairing: String Userid: String 我能够使用Google云平台Web视图的“按种类查询”功能成功地查询实体 我当前的代码实现似乎没有返回我想要的正确响应,尽管我可以在省略阈值过滤器行时发出请求。还设置了适当的索引 con
Exchange: String
Threshold: Floating Point Number
Pairing: String
Userid: String
我能够使用Google云平台Web视图的“按种类查询”功能成功地查询实体
我当前的代码实现似乎没有返回我想要的正确响应,尽管我可以在省略阈值过滤器行时发出请求。还设置了适当的索引
const query = datastore.createQuery('notifications_info')
.filter('exchange', '=', objectToRequest.exchange)
.filter('threshold', '<=', 0)
.filter('threshold', '>', -3)
.filter('pairing', '=', objectToRequest.pairing);
datastore.runQuery(query,function(error, results){
if(error){
console.log(error);
} else if (results){
console.log(results);
callback(error, results);
}
});
数据存储中的实体
| Exchange | Pairing | Threshold |
| gdax | ethusd | -1 |
| gdax | ethusd | -1 |
| gdax | ethusd | -0.1 |
我能够使用除数字和浮点以外的任何东西进行成功的查询。我希望有人能为我指明正确的方向,告诉我如何处理带有浮点的过滤器。由于节点不支持GQL,因此GQL似乎不是一个选项
谢谢。结果是0,如果我修改它并将其转换为0.0001,则运行良好结果是0,如果我修改它并将其转换为0.0001,则运行良好
| Exchange | Pairing | Threshold |
| gdax | ethusd | -1 |
| gdax | ethusd | -1 |
| gdax | ethusd | -0.1 |