influxdata / influxdb-client-js

InfluxDB 2.0 JavaScript client

Home Page:https://influxdata.github.io/influxdb-client-js/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

writeClient.writePoints() not working

sidparashar2001 opened this issue · comments

Specifications

  • Client Version:"@influxdata/influxdb-client": "1.8.0"
  • InfluxDB Version:
  • Platform:node.js

Code sample to reproduce problem


const token = 
const url = '';

const client = new InfluxDB({ url, token });

let org = `orgname`
let bucket = `bucketname`

// For writing the data
let writeClient = client.getWriteApi(org,bucket, 'ns');
const point1 = new Point('wandbbss')
  .tag('snsor_id', 'TLM01')
  .floatField('vaue', 24.0);
try{
  writeClient.writePoints(point1)
}catch(err){
  console.log(err)
}
writeClient.close().then(() => {
    console.log('WRITE FINISHED')
  })



Expected behavior

It should insert my data but it is not not inserting

Actual behavior

It doesn't did anything thing but when I use wrtePoint() then it worked

Additional info

No response

Hi @sidparashar2001,

Thank you for using our client.

The writePoints method expects a list of points. Please modify your code to something like: writeClient.writePoints([point1]).

Best regards