Specified time in Influx object

I'm receiving in HTTP IN a JSON containing, among other things, an id, some timestamps and some fields.
I need to store the fields into an InfluxDB by tag id and by timestamp.
So I create an JSON-object array. But I am unsure where to place the timestamp. InfluxDB only stores the object under the current timestamp of receiving.
This is the code in the function that creates the Object for the influxdb-node.


object=[];
nr=msg.payload.reports.length;
for (var i = 0; i < nr; i++) {
   
 var obj = [
  
  msg.payload.reports[i], // contains the fields
  {
   id:   msg.payload.imei.toString() // contains the tag
  },
//  {
//   time: msg.payload.reports[i].timestamp*1000000000
//  }
 
 ]
 object.push(obj);
 
}

msg.payload=object;
return msg;

Wherever I set the timestamp, it never comes as such in InfluxDB.

I'm using myself the code blow. Works great.
Don't think it's needed to correct for nano seconds if you have the time precision set to default in the influx out node.

var newmsg =[{
    Temperature:temp,
    Pressure:hkpa,
    time:new Date()
}]

Thanks!
Now I've got it working. I thought time is a special thing in Influx. Like tags and fields. But time is just a field. So when added to the fields-object it will work

 fields=msg.payload.reports[i];
 fields.time=msg.payload.reports[i].timestamp*1000000000; 
 var obj = [
  
  fields,
  {
   id:   msg.payload.imei.toString()
  }
 ]

Not quite. It is a field, but it isn't just a field, it a field with additional features and handling.
What does the above code give you in your obj array? Is that what you are passing on the influx?

This gives me two objects. The first containing the fields and the time, the second containing the tag.
This is passed to the Influx-node.

From the Info of the Influx-node:

If msg.payload is an array containing two objects, the first object will be written as the set of named fields, the second is the set of named tags.

And in the Info there is no mention of what to do with the time. But as i now found out time has to be part of the first object. I.e. the object containing the fields.

Yes, of course.
The full readme on github does include additional information about more unusual use cases, I believe.

But it is not that unusual wanting a specific time inserted into InfluxDB instead of the current time of inserting?
But thanks to this forum I am happy now!

More often when that is required there is a set of values to be written, with multiple timestamps, in which case the influx batch node is more efficient. You are right though, it would be worthwhile to include that in the help text, it may just be an oversight on the part of the author. You could raise an issue on the node's github page suggesting it is added, or even better fork the repository, improve the text, and submit a Pull Request.