Force Data Type as Float not String


Apologies if this is captured elsewhere, please redirect me.
Using Neo4j Community 3.5.6

I have input form fields in my app that capture separate, decimal longitude and latitude values...

<input type="number" min="-180" max="180" step=.000001 value="" />

The query I'm using to post the data is this...

Create(bry:Brewery {latitude: $latParam, longitude: $lngParam, address: $formatted_addressParam})

I would expect Neo4j to capture the lat lon data type as a float? but instead these are being posted as a string. How do I

  1. make it so these are posted as a float in the posting process
  2. convert all of the existing lat lon string data types to float

Many Thanks,


Hello @keithave :slight_smile:

You should have a look at toFloat() function:

CREATE (bry:Brewery {latitude: toFloat($latParam), longitude: toFloat($lngParam), address: $formatted_addressParam})
MATCH (bry:Brewery)
SET bry.latitude = toFloat(bry.latitude), bry.longitude = toFloat(bry.longitude)


Ah ok, thank you Cobra, so I can specify toFloat in the Create statement. The create statement forcing this data type of float doesn't seem to be documented anywhere? Or is there documentation for this?

I gave the link to the doc of toFloat but there is only that :slight_smile:

You bet, yea I saw that thank you, helpful for converting, but not very helpful for establishing a data type on creation. :slight_smile: I am very thankful for 'tribal knowledge' discussions like this since Neo4j has many gaps in documenting practices like this.