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
If we use a decimal field data will be saved as strings and of course there will be no way to run $gt or $lt operation on them, and this is so misleading.
A solution for this would be to save the rounded number in integer on the model and keep the decimal value in string just for the displaying, but this should be handled by DecimalField itself.
like:
score = DecimalField()
and should get saved on the database with a extra field to keep the data in rounded integer.
score = "23.548515515"
score_int = 24
and of course that behavior of the the field should be handled by filter too, like running filter(score__gte=13) should be translated to filter(score_int__gte=13), well that might require a lot of work to do.
But after all I guess it would be better to mention DecimalField behavior somewhere on the doc or just mock the DecimalField with IntegerField or something.
I think this kind of issue #112 is related to this.
The text was updated successfully, but these errors were encountered:
MongoDB doesn't support
float
ordecimal
field.If we use a decimal field data will be saved as strings and of course there will be no way to run
$gt
or$lt
operation on them, and this is so misleading.A solution for this would be to save the rounded number in integer on the model and keep the decimal value in string just for the displaying, but this should be handled by
DecimalField
itself.like:
and should get saved on the database with a extra field to keep the data in rounded integer.
and of course that behavior of the the field should be handled by
filter
too, like runningfilter(score__gte=13)
should be translated tofilter(score_int__gte=13)
, well that might require a lot of work to do.But after all I guess it would be better to mention
DecimalField
behavior somewhere on the doc or just mock theDecimalField
withIntegerField
or something.I think this kind of issue #112 is related to this.
The text was updated successfully, but these errors were encountered: