【发布时间】:2018-01-31 05:18:19
【问题描述】:
我一直在寻找解决问题的方法,但没有找到答案。 我的数据库中有这些数据
{
"_items": [
{
"_id": "5a69bbbe085eb50006b7515b",
"sku": "SAB-EM",
"name": "Sabão em pó",
"price": 12,
"promotions": [],
"_updated": "2018-01-25T11:13:02.000000Z",
"_created": "2018-01-25T11:13:02.000000Z",
"_etag": "49fda82778b967e008ba46f7600822e940abb92b",
"_links": {
"self": {
"title": "Product",
"href": "products/5a69bbbe085eb50006b7515b"
}
}
},
{
"_id": "5a69bbc7085eb50006b7515c",
"sku": "AMA",
"name": "Amaciante",
"price": 15,
"promotions": [
{
"bundle_quantity": 10,
"paid_quantity": 8,
"_cls": "QuantityBundlePromotion"
},
{
"bundle_quantity": 3,
"paid_quantity": 2,
"_cls": "QuantityBundlePromotion"
}
],
"_updated": "2018-01-25T11:13:11.000000Z",
"_created": "2018-01-25T11:13:11.000000Z",
"_etag": "2308eb7c8c597ee441229d593a545e7e61a30160",
"_links": {
"self": {
"title": "Product",
"href": "products/5a69bbc7085eb50006b7515c"
}
}
},
{
"_id": "5a69bbca085eb50006b7515d",
"sku": "DET",
"name": "Detergente",
"price": 2,
"promotions": [
{
"minimum_quantity": 5,
"discount_percentage": 0.15,
"_cls": "DiscountForMinimumQuantityPromotion"
}
],
"_updated": "2018-01-25T11:13:14.000000Z",
"_created": "2018-01-25T11:13:14.000000Z",
"_etag": "73583c72a90bc8b89e30d9b7ab5b904cd78827a1",
"_links": {
"self": {
"title": "Product",
"href": "products/5a69bbca085eb50006b7515d"
}
}
}
],
"_links": {
"parent": {
"title": "home",
"href": "/"
},
"self": {
"title": "products",
"href": "products?max_results=3"
},
"next": {
"title": "next page",
"href": "products?max_results=3&page=2"
},
"last": {
"title": "last page",
"href": "products?max_results=3&page=29"
}
},
"_meta": {
"page": 1,
"max_results": 3,
"total": 87
}
}
当我使用http://0.0.0.0:3000/products 搜索时,这就是结果。 有我的问题,我需要使用 like 运算符按 name 或 sku 进行搜索。但是我到处找,什么也没找到,我试过使用 MongoDB 格式,但它返回 400。
当我运行 http://0.0.0.0:3000/products?where=name=="SAB-EM" or sku=="SAB-EM" 时,它会返回一些内容,但我仍然需要使用 like 运算符来执行此操作,而不是文字。
PS:我无权访问 python-eve 配置。
Tks.
【问题讨论】:
标签: eve