Hello All i have a field in mongo DB has type doub...
# community-help
c
Hello All i have a field in mongo DB has type double and at the time of indexing i have explicitly added the datatype as float using patch request
Copy code
{
            "name": "attributevalue",
            "type": "float",
            "sort": true,
            "optional": true
        },
But after that when i fetch the data , i see it in double quotes in typesense, i believe it should be
0.06498
rather than "`0.06498`"
Copy code
"attributevalue": "0.06498",
Due to this sort is not working as expected .
j
That sounds odd. Could you help replicate this issue with a set of curl commands like this: https://gist.github.com/jasonbosco/7c3432713216c378472f13e72246f46b
c
I did ran the commands and following were the outputs 1. for debug curl command { "state": 1, "version": "0.25.1" } 2) When i try this command
Copy code
curl "<http://localhost:8108/collections>" \       -X POST \       -H "Content-Type: application/json" \       -H "X-TYPESENSE-API-KEY: ${TYPESENSE_API_KEY}" \       -d '{         "name": "companies",         "fields": [           {"name": "company_name", "type": "string" },           {"name": "num_employees", "type": "int32" },           {"name": "country", "type": "string", "facet": true }         ],         "default_sorting_field": "num_employees"       }'
I get the error message that
Copy code
"message": "A collection with name `companies` already exists."
3) When i create a new entry using curl curl "http://localhost:8108/collections/companies/documents/import?action=create" \ it creates the new entry in float format
j
So the issue is not reproducible?
c
The existing fields are not getting changes , but new values which are added to typesense has float values
j
I didn't quite understand that
Could you share the exact curl commands you ran and the output of each, step-by-step and point out where the issue in the response json of the curl request?
c
When i run the create command curl "http://localhost:8108/collections/companies/documents/import?action=create" \ -H "X-TYPESENSE-API-KEY: ${TYPESENSE_API_KEY}" \ -H "Content-Type: text/plain" \ -X POST \ -d '{"id": "124","company_name": "Stark Industries","attributevalue": "0.06498,"country": "USA"} {"id": "125","company_name": "Acme Corp","num_employees": 2133,"country": "CA"}' The data is added and the value contains float values ,
But after indexing command should i restore typesense to convert the existing data which is string to float