Skip to content

SensorThings $orderBy=phenomenonTime desc is ignored #459

Description

@daniel-slaugh

Steps to Reproduce

Attempt to get the latest observation from a datastream:

https://hydroserver.waterrights.utah.gov/api/sensorthings/v1.1/Datastreams?$select=id,name,properties&$expand=Thing($select=id,name,properties),Observations($select=result,phenomenonTime;$orderby=phenomenonTime%20desc;$top=1)&$top=1000

Expected Behavior

This should get the latest observation from the datastream.

Actual Behavior

Instead the first observation is returned.

Any additional comments?

I was able to get the latest observation by also including Datastream/id, but the first request with only the phenomenonTime ordering should work. It seems that HydroServer requires both before it honors phenomenonTime.

https://hydroserver.waterrights.utah.gov/api/sensorthings/v1.1/Datastreams?$select=id,name,properties&$expand=Thing($select=id,name,properties),Observations($select=result,phenomenonTime;$orderby=Datastream/id%20asc,phenomenonTime%20desc;$top=1)&$top=1000

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

Fields

No fields configured for Bug.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions