Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

q=modifiedAt or q=modifiedAt>aDate always returns an empty array #1458

Closed
live-buildings opened this issue Oct 27, 2023 · 7 comments
Closed
Assignees
Labels
bug Something isn't working Fixed - needs validation

Comments

@live-buildings
Copy link

On Orion-LD v1.4.0, GET /ngsi-ld/v1/entities does not correctly handle "q=modifiedAt"

I have some entities of type Site in the context. My goal is to retrieve all context entities of type Site that where modified after a given date. But "q=modifiedAt" seems not to be supported by /ngsi-ld/v1/entities.

This request does return my entities:
http://[::1]:1026/ngsi-ld/v1/entities?type=Site

But this request returns an empty array, whereas it should return them all:
http://[::1]:1026/ngsi-ld/v1/entities?type=Site&q=modifiedAt

And this one returns an empty array as well, whereas it should return the ones that have been modified after january, the 1st:
http://[::1]:1026/ngsi-ld/v1/entities?type=Site&q=modifiedAt>2023-01-01T00:00:00Z

@kzangeli
Copy link
Collaborator

"q=modifiedAt" ...
Yeah I probably don't handle that case.
Are you aware of the fact that all entities have a "modifiedAt" ?
It makes no sense to perform that query, and frankly, I'd forbid it in the API.
First time this comes up ...

"q=modifiedAt>2023-01-01T00:00:00Z", on the other hand makes sense.
Might be you need to quote the timestamp. I'll have a look in the spec, can't remember.
Anyway, if that was true (needing quotes), the broker should respond with an error.
So, here I definitely need to do something!

Thanks for reporting!

@kzangeli kzangeli self-assigned this Oct 27, 2023
@kzangeli kzangeli added the bug Something isn't working label Oct 27, 2023
@kzangeli kzangeli mentioned this issue Oct 27, 2023
@live-buildings
Copy link
Author

Thanks for replying.
I agree that "q=modifiedAt" makes no sense as all entities have a "modifiedAt" attribute, however I don't see anything in the spec that would prevent this request to work and return the whole list of related entities anyway. (actually, from my point of view, it is usefull when building a request step by step :) )

@live-buildings
Copy link
Author

I have just tested with quote modifiedAt>"2023-01-01T00:00:00Z". The response is the same : empty array.

@kzangeli
Copy link
Collaborator

Yeah, I just found a line about "modifiedAt/createdAt" and "q" in my ToDo list.
Not yet implemented, so, they're both assumed to be regular attributes in the DB, but they're not, so, they will always give a "not found" and thus no hits.

I'll try to find some time to fix this. Quite of busy right now, so, I can't really promise any time frame for this.

@live-buildings
Copy link
Author

Many thanks !

@kzangeli kzangeli mentioned this issue Nov 3, 2023
@kzangeli
Copy link
Collaborator

kzangeli commented Nov 3, 2023

The issue is hopefully fixed. Please test and close this issue if everything is working as expected.
[ I implemented a 400 Bad Request response if you try to use the "Exists" operator for builtin timestamps. ]

@live-buildings
Copy link
Author

Tested against 1.5.0-PRE-1526. The issue is fixed. It works both on anEntity.modifiedAt and anEntity.anyProperty.modifiedAt.
Many thanks !

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working Fixed - needs validation
Projects
None yet
Development

No branches or pull requests

2 participants