Search code examples
c#.netinfluxdb

Adding a float whole number into InfluxData.Net as field throws exception assuming it is an integer


I'm using <package id="InfluxData.Net" version="8.0.1" targetFramework="net462" />

In this Issue it is said that

all numbers are now floats unless explicitly declared integers during writes (with a trailing i #3526). Closing as no longer relevant.

But when I add a field with a Key FloatValue and Value - float without decimal places it throws exception

System.AggregateException: 'One or more errors occurred. (InfluxData API responded with status code=BadRequest, response={"error":"partial write: field type conflict: input field \"FloatValue\" on measurement \"forests\" is type integer, already exists as type float dropped=4"} )'

Here is a printscreen: enter image description here

Any solutions to fix the adding ?


Solution

  • The problem was that I recieved the float as an object and immedietly assigned it to the Point, although the field value expects an object I needed to cast it to float first.