You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
NOT OK -> (syntax 2)
Postman params passed:
$or[]:{"title":"shirt"},{"q":"shirt"} curl --location 'http://localhost:9000/admin/products?%24or[]={%22title%22%3A%22shirt%22}%2C{%22q%22%3A%22shirt%22}' \ --header 'Authorization: Bearer xxxx' \ --data ''
Both response are:
http: GET /admin/products?limit=2&fields=title&$or[]="title":"shirt","q":"shirt" ← - (400) - 5.119 ms
error: Invalid request: Expected type: 'object' for field '$or, 0', got: 'string'; Expected type: 'object' for field '$or, 1', got: 'string'
For this second query using $or maybe my syntax is incorrect but tried a multiple
Expected behavior
PRODUCTS SORTING
Sorting by ID -> OK
Sorting by status -> NOT OK
PRODUCTS SEARCHING
A result without error.
Actual behavior
PRODUCTS SORTING
Sorting only by ID is possible
PRODUCTS SEARCHING
http: GET /admin/products?limit=2&fields=title&$or[]="title":"shirt","q":"shirt" ← - (400) - 5.119 ms
error: Invalid request: Expected type: 'object' for field '$or, 0', got: 'string'; Expected type: 'object' for field '$or, 1', got: 'string'
I am experiencing the same issue!
I tried sorting products using various keys like created_at, updated_at, title, status and others, but the sorting only works for the id field.
Below is my package.json dependencies object for reference:
Package.json file
Node.js version
v20.17.0
Database and its version
PostGresSQL 13
Operating system name and version
Mac Os
Browser name
Brave/Chrome
What happended?
--
OK -> Results are sorted by id
curl --location 'http://localhost:9000/admin/products?limit=2&fields=title%2Cstatus&order=-id' \ --header 'Authorization: Bearer xxxx' \ --data ''
Response: Products sorted
NOT OK -> Results aren't sorted by status (draft, published etc.)
curl --location 'http://localhost:9000/admin/products?limit=2&fields=title%2Cstatus&order=-status' \ --header 'Authorization: Bearer xxxx' \ --data ''
curl --location 'http://localhost:9000/admin/products?limit=2&fields=title%2Cstatus&order=status' \ --header 'Authorization: Bearer xxxx' \ --data ''
Response: Products NOT sorted (no matter "-" sign )
--
NOT OK -> (syntax 1)
Postman params passed:
$or[]:{"title":"shirt"}
$or[]:{"q":"shirt"}
curl --location 'http://localhost:9000/admin/products?%24or[]={%22title%22%3A%22shirt%22}&%24or[]={%22q%22%3A%22shirt%22}' \ --header 'Authorization: Bearer xxxx' \ --data ''
NOT OK -> (syntax 2)
Postman params passed:
$or[]:{"title":"shirt"},{"q":"shirt"}
curl --location 'http://localhost:9000/admin/products?%24or[]={%22title%22%3A%22shirt%22}%2C{%22q%22%3A%22shirt%22}' \ --header 'Authorization: Bearer xxxx' \ --data ''
Both response are:
http: GET /admin/products?limit=2&fields=title&$or[]="title":"shirt","q":"shirt" ← - (400) - 5.119 ms
error: Invalid request: Expected type: 'object' for field '$or, 0', got: 'string'; Expected type: 'object' for field '$or, 1', got: 'string'
For this second query using $or maybe my syntax is incorrect but tried a multiple
Expected behavior
Actual behavior
http: GET /admin/products?limit=2&fields=title&$or[]="title":"shirt","q":"shirt" ← - (400) - 5.119 ms
error: Invalid request: Expected type: 'object' for field '$or, 0', got: 'string'; Expected type: 'object' for field '$or, 1', got: 'string'
Link to reproduction repo
http://localhost:9000
The text was updated successfully, but these errors were encountered: