我有一个问题,要用$like操作符将REST查询发送到featherjs。
表:
ID Textfield
安德烈亚斯1
查询获取
localhost:3030/table?textfield$like=andreas
重划
查询获取localhost:3030/table?textfield$like=andrea
localhost:3030/table?textfield$like=andrea%
localhost:3030/table?textfield$like=andrea*
所有此查询返回0行。
模型是对-> Server进行后缀的
这个网址有什么问题。
发布于 2017-06-05 11:57:56
我在您的测试表中添加了一个createdAt和updatedAt字段来设置您的示例。
我使用了-> MySQL后遗症模型
表:
ID Textfield
安德烈亚斯1
我用邮递员来测试你的GET查询:
localhost:3030/table?textfield[$like]=andreas
returns:
{
"total": 1,
"limit": 20,
"skip": 0,
"data": [
{
"id": 1,
"textfield": "andreas",
"createdAt": "2017-06-05T11:33:38.000Z",
"updatedAt": null
}
]
}
localhost:3030/table?textfield[$like]=andrea%
returns:
{
"total": 1,
"limit": 20,
"skip": 0,
"data": [
{
"id": 1,
"textfield": "andreas",
"createdAt": "2017-06-05T11:33:38.000Z",
"updatedAt": null
}
]
}
localhost:3030/table?textfield[$like]=%drea%
returns:
{
"total": 1,
"limit": 20,
"skip": 0,
"data": [
{
"id": 1,
"textfield": "andreas",
"createdAt": "2017-06-05T11:33:38.000Z",
"updatedAt": null
}
]
}以下查询不应返回任何内容,因为'andrea‘不能在数据库中完全匹配,而且星号(*)在类似于SQL的语法like.asp中并不是一个通配符:
localhost:3030/table?textfield[$like]=andrea
localhost:3030/table?textfield[$like]=andrea*
{
"total": 0,
"limit": 20,
"skip": 0,
"data": []
}https://stackoverflow.com/questions/43941880
复制相似问题