# Influxdb 2.0 Error Data Type

**URL:** <https://discourse.nodered.org/t/influxdb-2-0-error-data-type/36138>\
**Category:** General\
**Created:** [18 November 2020 13:21 UTC](https://discourse.nodered.org/t/influxdb-2-0-error-data-type/36138 "2020-11-18T13:21:09Z")\
**Posts on this page:** 11\
**Page:** 1

<div class="post-metadata">

**Author:** ![hermiot](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/hermiot/32/28140_2.png) [@hermiot](https://discourse.nodered.org/u/hermiot)\
**Post date:** [18 November 2020 13:21 UTC](https://discourse.nodered.org/t/influxdb-2-0-error-data-type/36138/1 "2020-11-18T13:21:10Z")

</div>

Hi, I'm using node-red-contrib-influxdb (0.5.0) to pipe data into an Influxdb V2.  
After the updateto V2 I'm facing the following error:

> Error: 500 Internal Server Error : {"code":"internal error","message":"unexpected error writing points to database: partial write: field type conflict: input field "ITE06\_H" on measurement "ITE06" is type integer, already exists as type float dropped=1"}

It seems to be a problem with the datatype. If i.e. the temperature value is 20 it's an integer, 20.1 a float. But the table only supports one type.  
Is there a way to convert numbers befor sending them to influxdb?

This error occures after updating node-red-contrib-influxdb to 0.5.0 and influxdb to V2.

Thank you very much for any advise!  
Martin

---

<div class="post-metadata">

**Author:** ![zenofmud](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/zenofmud/32/316_2.png) [@zenofmud](https://discourse.nodered.org/u/zenofmud)\
**Post date:** [18 November 2020 16:42 UTC](https://discourse.nodered.org/t/influxdb-2-0-error-data-type/36138/2 "2020-11-18T16:42:03Z")

</div>

> [@hermiot](#):
>
> Is there a way to convert numbers befor sending them to influxdb?

You could always use a parseInt() or round() on the number

---

<div class="post-metadata">

**Author:** ![Marooned](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/marooned/32/2858_2.png) [@Marooned](https://discourse.nodered.org/u/Marooned)\
**Post date:** [18 November 2020 18:31 UTC](https://discourse.nodered.org/t/influxdb-2-0-error-data-type/36138/3 "2020-11-18T18:31:31Z")

</div>

Changing/rounding to integer is easy. I'm trying to write temperature to Influx 1.8 and have exactly the same issue. 20 degrees set the field as integer, 20.1 as float. I would like to preserve decimal to have more precision.  
I've tried to use `.toFixed(2)` but that change the type to string, which is not what I want.

So how to enforce float type even with values without decimal?  
Thanks

---

<div class="post-metadata">

**Author:** ![Colin](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/colin/32/17040_2.png) [@Colin](https://discourse.nodered.org/u/Colin)\
**Post date:** [18 November 2020 21:25 UTC](https://discourse.nodered.org/t/influxdb-2-0-error-data-type/36138/4 "2020-11-18T21:25:09Z")

</div>

I wonder whether this is a problem with the new version of the influx node. I have never had any problems like this with the previous versions.  
In fact looking at [https://github.com/mblackstock/node-red-contrib-influxdb/issues/49](https://github.com/mblackstock/node-red-contrib-influxdb/issues/49) it seems the previous version did not write integer types at all, so I suspect they have added that feature, with the result that now it is apparently possible to create field with integer type, and then you are stuck.  
I see this problem has just been added as an issue, unless that issue has been submitted by someone here. [https://github.com/mblackstock/node-red-contrib-influxdb/issues/71](https://github.com/mblackstock/node-red-contrib-influxdb/issues/71)

---

<div class="post-metadata">

**Author:** ![Marooned](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/marooned/32/2858_2.png) [@Marooned](https://discourse.nodered.org/u/Marooned)\
**Post date:** [18 November 2020 23:41 UTC](https://discourse.nodered.org/t/influxdb-2-0-error-data-type/36138/5 "2020-11-18T23:41:32Z")

</div>

Your second link should probably point to [https://github.com/mblackstock/node-red-contrib-influxdb/issues/71](https://github.com/mblackstock/node-red-contrib-influxdb/issues/71)  
I've commented that issue for mode details.

---

<div class="post-metadata">

**Author:** ![hermiot](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/hermiot/32/28140_2.png) [@hermiot](https://discourse.nodered.org/u/hermiot)\
**Post date:** [19 November 2020 06:53 UTC](https://discourse.nodered.org/t/influxdb-2-0-error-data-type/36138/6 "2020-11-19T06:53:13Z")

</div>

I opened #71 and it was already fixed by owner.  
Hopefully he'll release it in short time.

---

<div class="post-metadata">

**Author:** ![Colin](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/colin/32/17040_2.png) [@Colin](https://discourse.nodered.org/u/Colin)\
**Post date:** [19 November 2020 10:10 UTC](https://discourse.nodered.org/t/influxdb-2-0-error-data-type/36138/7 "2020-11-19T10:10:26Z")

</div>

> [@Marooned](#):
>
> Your second link should probably point to

Correct, thanks for noticing that, have corrected my original post.

---

<div class="post-metadata">

**Author:** ![Colin](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/colin/32/17040_2.png) [@Colin](https://discourse.nodered.org/u/Colin)\
**Post date:** [19 November 2020 10:24 UTC](https://discourse.nodered.org/t/influxdb-2-0-error-data-type/36138/8 "2020-11-19T10:24:05Z")

</div>

> [@hermiot](#):
>
> Hopefully he'll release it in short time.

I you want to install it direct from the git repository you can go to your .node-red folder and run  
`npm install mblackstock/node-red-contrib-influxdb`  
and restart node-red.  
When it has been released, or if you want to go back to the issued version go to that folder and run  
`npm remove node-red-contrib-influxdb`  
`npm install node-red-contrib-influxdb`  
and restart node-red.

---

<div class="post-metadata">

**Author:** ![mike](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/mike/32/10_2.png) [@mike](https://discourse.nodered.org/u/mike)\
**Post date:** [20 November 2020 04:10 UTC](https://discourse.nodered.org/t/influxdb-2-0-error-data-type/36138/9 "2020-11-20T04:10:18Z")

</div>

Thanks for reporting this, and sorry for the trouble.

I did a quick release to add support for integer values using strings as mentioned in the issue comments. To write an integer 10, use a string with an 'i' suffix: '10i', to write a float 10.0 use a number: 10 or 10.0.

I plan to update the docs and add some more tests soon. Let me know if you see any other problems by raising an issue on github.

---

<div class="post-metadata">

**Author:** ![Colin](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/colin/32/17040_2.png) [@Colin](https://discourse.nodered.org/u/Colin)\
**Post date:** [20 November 2020 21:05 UTC](https://discourse.nodered.org/t/influxdb-2-0-error-data-type/36138/10 "2020-11-20T21:05:52Z")

</div>

Thanks for the work on this node, I was wondering recently whether I should contemplate migrating to v2, now at least it should not be problematic at the node-red end.

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/1X/d073cd938eafa2e558d7c2cd59003b3ef4963033.png) [@system](https://discourse.nodered.org/u/system)\
**Post date:** [4 December 2020 21:06 UTC](https://discourse.nodered.org/t/influxdb-2-0-error-data-type/36138/11 "2020-12-04T21:06:06Z")

</div>

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.
