Skip to Main Content

ORDS, SODA & JSON in the Database

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Can't use "$orderby" in JSON Duality View

phartenfellerFeb 6 2024

I have a this json duality view rest enabled:

create or replace json relational duality view movie_test_jdv as
movies
{
_id: movie_id,
title,
description,
year,
runtime,
imdb_rating
}
;

I can use many of the filters on it without issues:

  • Generic get /ords/movies/movie_test_jdv
  • Filter by title /ords/movies/movie_test_jdv?q={"title":{"$instr": "%Endg"}}
  • Filter by rating /ords/movies/movie_test_jdv?q={"imdb_rating":{"$gt":8.5}}

But anytime I use order by it gives me a 404 error page:

  • /ords/movies/movie_test_jdv?q={"$orderby":{"imdb_rating":"desc"}}.
  • /ords/movies/movie_test_jdv?q={"$orderby":{"year":"desc"}}
  • /ords/movies/movie_test_jdv?q={"$orderby":{"title":"desc"}}

To double checked I rest enabled the underlying table and I am able to order by the same columns on there: /ords/movies/movies?q={"$orderby":{"imdb_rating":"desc"}}.

I attached the stack trace below. I don't see any logs in stdout.

Here is a JSON document returned from the view:

{
"movie_id": 111161,
"title": "The Shawshank Redemption",
"description": "Framed in the 1940s for the double murder of his wife and her lover, upstanding banker Andy Dufresne begins a new life at the Shawshank prison, where he puts his accounting skills to work for an amoral warden. During his long stretch in prison, Dufresne comes to be admired by the other inmates -- including an older prisoner named Red -- for his integrity and unquenchable sense of hope.",
"year": 1994,
"runtime": 142,
"certificate": 12,
"budget_currency": "$",
"world_wide_gross": 58500000,
"budget": 25000000,
"imdb_rating": 9.3,
"votes": 2101092,
"original_language": "en",
"links": [
{
"rel": "self",
"href": "http://**********/ords/movies/movies/111161"
}
]
},

I have installed ORDS 23.4.0.r3461619 on Oracle Database 23c Free Release 23.0.0.0.0 both via Docker containers.

Thanks!

stackTrace.log

This post has been answered by thatJeffSmith-Oracle on Feb 7 2024
Jump to Answer
Comments
Post Details
Added on Feb 6 2024
3 comments
727 views