String Functions in DQL

Experience Report for Feature Request

What you wanted to do

Use String Functions within DQL to do upserts and transform data on server side without client script.

What you actually did

Started this Topic :wink: After I double checked and searched the docs again and searched this forum for “String Functions”

Why that wasn’t great, with examples

Because there are not any string functions. I understand the GraphQL experience with Dgraph, but when I want to do data work behind the generated API, it becomes difficult. This makes me miss my relational database. Wish to not be reminded of that time in my life, lol.

I would like to not need an external script everytime I just want to do onetime actions. This causes much frustration for me.

Examples of string functions in neo4j:

  • left()
  • ltrim()
  • replace()
  • reverse()
  • right()
  • rTrim()
  • split()
  • substring()
  • toLower()
  • toString()
  • toUpper()
  • trim()
  • + for concatenation

Examples of String Functions in MySQL:

  • CONCAT()
  • CONCAT_WS()
  • INSERT()
  • LEFT()
  • LCASE()
  • LTRIM()
  • MID()
  • etc.

Example of String Functions supported by mongoDB:

  • CONCAT()
  • LCASE()
  • LEFT()
  • LTRIM()
  • UCASE()
  • etc.

Any external references to support your case

https://dev.mysql.com/doc/refman/8.0/en/string-functions.html

11 Likes

Lots of new feature requests for DQL this week :slight_smile:

I’m loving this one

3 Likes

I will add a use case while I am staring at a tough solution without String Functions.

I have a Contact type that stores the first name and last name as separate predicates. This is the standard for most CRMs. Now trying to find a contact given a full name, “Anthony Master”, becomes quite difficult.

I do not want all of the firstName Anthony’s with a different last name, and I don’t want all of the Master family who isn’t Anthony. So I have to separate the text on the client side and apply two different filters: firstName=Antony & lastName=Master.

This issue amplifies as more UIs are built around the same db. (That is the future of our this db serving many different UIs) Now every UI has to have the equivalence of taking the full name and dividing it up and sending it to the db.

This can be solved with upcoming hooks, but I would really like it in the lower level of the db itself and not rely on a custom built hook. Although I see many hooks in my future. Maybe I should buy a tackle box to keep up with all of them.

I know the dilemma seems smaller than what I am making it, but I am just used to being able to do database side concatenation and comparison. It makes the UI footprint smaller and transfers the workload to the database. With modern computing and advances in client side tech, this problem is diminished, until we look at the rise of chromebooks and other streamlined clients that don’t offer much processing at all. We have the strongest man in the world, and we are making the 10 year old boy have to carry his backpack? I want to let the stronger device to the heavy lifting.

2 Likes

For back link reference:

I want that too. :slight_smile: Would be awesome.

I would like that too. Please add “concat” function as well.

1 Like

Any news on this ticket?

Did this get done? This is something I’m trying to use today :slight_smile:

No :frowning:

any update on this?