javascript - nanoscale.io 商店的查询语法

标签 javascript store microservices

有谁知道如何使用查询字符串来访问 Nanoscale.io 中的存储(集合)数据?我尝试阅读他们的文档,但唯一的示例如下:

local.request = new AP.Store.Request();
local.request.select("Tasks", "priority >= $1 order numeric(priority) asc", parseInt(request.params.priority));

我不知道“priority >= $1 order numeric(priority) asc”中的语法来自哪里...

在他们的文档中:

select(collection, query)

Selects matching objects from a collection based off of the query string.

collection [string] - Collection name.

query [string | number] - This can be either a query or a number. If a number, the operation will return the object that has a matching ID. To return all, use the string "true".

除了“true”之外,我不知道如何形成自己的查询。

最佳答案

在您提供的示例中(并在文档中提供),priority将是您的集合中您有兴趣搜索的字段,并且 $1是 select 函数中提供的下一个值,即 parseInt(request.params.priority)request.params.priority是查询参数“priority”的值,在本例中,为了比较,它被解析为 int。

根据我的发现,您可以进行所有基本比较( =!=>(=)<(=) )。

关于javascript - nanoscale.io 商店的查询语法,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/42392789/

相关文章:

authentication - 为什么API网关和认证服务应该不同?

node.js - API 网关和微服务通信

javascript - 重置自定义 JavaScript 下拉列表而不刷新页面

extjs - Extjs 4 存储上的加载监听器不起作用

iphone - 验证收据 Autorenewable 订阅

PHP - 如何将大量文件路径存储到 MySQL 数据库?

spring-boot - 使用参数运行Docker镜像

javascript - jQuery 手机 : How to navigate between dynamically generated pages

JavaScript 本地作用域 : var vs. this

javascript - 单击 HTML 按钮或 JavaScript 时如何触发文件下载