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

[Bug][Operators] Error when using min operator using DateTime type #4585

Closed
mapedraza opened this issue Jun 18, 2024 · 1 comment
Closed
Labels
Milestone

Comments

@mapedraza
Copy link
Collaborator

mapedraza commented Jun 18, 2024

Bug description

Operator $min doesn't work to update an existing attribute defined with DateTime and using it for the update as well, returning the following error when trying to make an update: {"error":"BadRequest","description":"date has invalid format"}

This enables some uses cases for date updates coming from IoTA

How to reproduce it

For an existing entity having an attribute using type DateTime and named dateAttr, updating it like this:

curl 'https://orion/v2/entities/E1/attrs?type=T1' \
  -X 'PATCH' \
  -H 'content-type: application/json' \
  -H 'fiware-service: service' \
  -H 'fiware-servicepath: /subservice' \
  --data-raw $'{"dateAttr":{"type":"DateTime","value":{"$min":"2024-04-15T10:59:59.000Z"},"metadata":{}}}'

Expected behavior
The oldest (minimum) date should be stored in the CB

Additional information

Mongo DB supports the use of this operator to compare dates:
https://www.mongodb.com/docs/manual/reference/operator/update/min/#use--min-to-compare-dates

@mapedraza mapedraza added the bug label Jun 18, 2024
@fgalan fgalan added this to the 4.1.0 milestone Aug 1, 2024
@mapedraza
Copy link
Collaborator Author

After merging #4598 this issue is solved

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants