I have defined a field called Postcode and set the type text. When I enter postcode 85221 and save the collection even though this field defined as text api converts it to int inside the json. Is this expacted behaviour? How can I force api to return this value as string.
I looked into the database and it happens on save. So it’s not an output problem.
Just tested with commenting out these two lines:
Now int values are stored as strings and the api output is string, too. But I don’t understand why the checks are there. //JSON_NUMERIC_CHECK - without destroying values with leading zeros sounds important.
Thanks for pointing out the correct places. Yes it sounds important but also I believe it should not convert text field values to int values? Maybe the field type check would prevent this misbehavior?
@artur Can you explain, why the check was there? It looked important and it looked like you wrote the MongoLite class yourself in the past. I just want to understand the reason, if something else could break in the future or if other related issues come up in the future.
Using this variant and adding “42e3” as an entry leads to “42e3” in the database and the input field in the backend converts its appearance to “42000”.